2018年11月1日星期四

React and Traffic Lights

A small JavaScript project for controlling and animating a set of LEDs that act like Traffic Lights via a arduino Microcontroller.
Hardware components


Arduino UNO

LED (generic)
Resistor 330 ohm
Jumper wires (generic)

Software apps and online services
Johnny-Five

Diagram
The diagram is pretty simple — connect up each arduino  LED to pins 11, 10, and 9, respectively, along with the 220Ohm resistors for each LED. Remember to attach the Ground so the circuit can work! All in all, the circuit is very simple to put together.

Installing
You can use NPM or Yarn to install and use the application, though I recommend yarn, it's pretty good for dependency management.

You can do npm install or yarn install to download all the app's dependencies.

Commands
There are various commands you can use to work the app, from building, to development, to testing. Again, you can use Yarn or NPM to run the app.

List of Commands

start — Start the app Server (note: run build first!)build — Build the app for a production environmentdev-start — Start the app server under the development environmentdev-server — Runs the Webpack development server for the client-side React appstyles — Build the Application styles (uses PostCSS)test — Runs ESlint and Flow to check the code for issues.


























没有评论:

发表评论