Basic Information

This page allows you to fork a new project from an existing project (Layout manager examples). The newly forked project will be listed in the IoT Projects page as a new entry. If you want to overwrite the existing project, please edit it instead.

* Photo URLs that end with any one of .jpg, .jpeg, .png or that are uploaded to the Gyazo web service in the PNG format (e.g.https://gyazo.com/hogehoge) are supported.

* Node.js entry point main: index.js and dependencies to the npm module dependencies: { f3js: (略) } will be automatically added and thus do not need to be in this form.

Private Project

Unchecking this will make the project public and be listed in the IoT Projects page. The checkbox is unchecked by default since we want you to share the projects! Additionally, you cannot check this unless you are logged in. Once you make the project public, it cannot be undone. (Any edits to the project except for forking will also be public.)

Source Code

Provide the source code of a microcontroller or tiny computer in JavaScript. Node.js-based computers are supported. Require f3js package and use its API to design the device enclosure.

var f3js = require('f3js') , c = f3js.cc(); c.x = 20; c.y = 10; c.drawCircle(80, 80, 80); // 円を描く var Grove = require('jsupm_grove') , i2clcd = require('jsupm_i2clcd') , buttons = [] , numButtons = 5; // ボタン数 [1, 5] var circleGuide = c.drawCircle(80, 80, 40); // ガイドを描く circleGuide.layout = { name: 'distribute', valign: 'top' }; for (var i = 0; i < numButtons; i ++) { var circle = c.drawCircle(0, 0, 10); c.add(circle, circleGuide); var button = new Grove.GroveButton(3 + i); c.add(button, circleGuide); // ボタンを配置する buttons.push(button); } c.drawCircle(270, 90, 90); var sizeUnawareCircleGuide = c.drawCircle(270, 90, 40); sizeUnawareCircleGuide.layout = { name: 'distribute', size: false, rotate: false }; var lcd = new i2clcd.Jhd1313m1(); c.add(lcd, sizeUnawareCircleGuide); c.add(new Grove.GroveButton(2), sizeUnawareCircleGuide); c.add(new Grove.GroveButton(3), sizeUnawareCircleGuide); c.add(new Grove.GroveButton(4), sizeUnawareCircleGuide); var lineGuide = c.drawLine(0, 200, 160, 200); lineGuide.layout = { name: 'align', padding: 5 }; for (var i = 0; i < numButtons; i ++) { var button = new Grove.GroveButton(3 + numButtons + i); c.add(button, lineGuide).rotate(10 * i); // ボタンを配置する buttons.push(button); } var lineWrappingGuide = c.drawLine(160, 230, 160, 270); lineWrappingGuide.layout = { name: 'align' }; for (var i = 0; i < numButtons; i ++) { var button = new Grove.GroveButton(3 + numButtons * 2 + i); c.add(button, lineWrappingGuide); // ボタンを配置する buttons.push(button); } setInterval(function () { // ボタンが押されたらコンソールにメッセージを出す for (var i = 0; i < buttons.length; i ++) { if (buttons[i].value() > 0) console.log('button(' + i + ') pressed.'); } }, 100); // その他のコードは http://f3js.org/projects を見てみましょう! // APIドキュメントは http://f3js.org/docs にあります。
Customization

This content does not allow any customization.

Layout view options
Adding comments to variable declarations in the source code populate various GUI widgets in the "Customization" section depending on their types.

Design Alternatives

Modules

No modules are required for this project.

Layout
Program

Login first to use this feature.