Basic Information

This page allows you to fork a new project from an existing project (Simple blinking LED project). 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.

Card preview
Simple blinking LED project
'16/9/18 18:36
One or more LEDs blink at a certain interval.
arc@dmz

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.

/** LED blinking app for Intel Edison */ var n = 4 // number of LEDs [1,4] , width = 130 , height = 105 , thickness = 45; // for building the enclosure layout var f3js = require('f3js') , c = f3js.createContainer() , rect = c.drawJointRectangle(0, 0, width, height) , line = c.drawLine(30, height/2 - 5, width - 30, height/2 - 5); // for blinking LEDs var groveDriver = require('jsupm_grove') , leds = []; // use this line as the guide path line.layout = { name: 'distribute', rotate: false }; for (var i = 0; i < n; i ++) { var led = new groveDriver.GroveLed(i+2); // put an LED module var ledc = c.add(led, line); // open a hole for the wire ledc.drawRectangle(- 10, 15, 20, 10); // start blinking the LED (details omitted) leds.push(led); setTimeout(function () { leds[i].handler = setInterval(blink(i), 1000); }, i * 100); } // make the specified LED blink (details omitted) function blink(i) { var id = i, on = false; return function () { leds[id][on?'off':'on'](); on = !on; }; } // extrude the main panel to form a box shape rect.jointHeight = 2; var planes = rect.extrude(thickness); // put side boards (details omitted) { // set some offset c.x = 10; c.y = 10; planes[0].x = 0; planes[0].y = height + rect.jointHeight; c.add(planes[0]); planes[1].x = width; planes[1].y = height + rect.jointHeight; c.add(planes[1]); planes[2].x = height; planes[2].y = height + thickness + rect.jointHeight; c.add(planes[2]); planes[3].x = 0; planes[3].y = height + thickness + rect.jointHeight; c.add(planes[3]); planes[4].x = width; planes[4].y = 0; c.add(planes[4]); // put a side hall planes[3].drawRectangle( 5, thickness - rect.jointHeight - 15, height - 10, 10); } // print message and register SIGINT handler (details omitted) { console.log('ready'); process.on('SIGINT', onExit); // clean up before the death function onExit() { for (var i = 0; i < n; i ++) { clearInterval(leds[i].handler); leds[i].off(); } } }
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.