This shows you the differences between two versions of the page.
|
tutorials:arduino:controlling_led [2014/02/26 11:19] sam |
tutorials:arduino:controlling_led [2014/03/03 10:13] (current) allen [Source Code] |
||
|---|---|---|---|
| Line 9: | Line 9: | ||
| ===== Make LED Lights flashing ===== | ===== Make LED Lights flashing ===== | ||
| + | {{:tutorials:arduino:image.jpeg|400}} | ||
| + | ===== Schematics ===== | ||
| + | {{:tutorials:arduino:xlzomm.jpg?500|}} | ||
| - | 1 you should install arduino ide. Please refer to | + | ===== Steps ===== |
| + | |||
| + | 1. you should install arduino ide. Please refer to | ||
| [[http://docs.cubieboard.org/tutorials/arduino/connecting|how to connect cubieboard and arduino]] | [[http://docs.cubieboard.org/tutorials/arduino/connecting|how to connect cubieboard and arduino]] | ||
| - | 2 connect arduino and led. | + | 2. connect arduino and led as the Schematics |
| - | {{:tutorials:arduino:xlzomm.jpg?500|}} | + | 3. Use usb to connect arduino and cubieboard . |
| - | + | ||
| - | 3 Use usb to connect arduino and cubieboard . | + | |
| - | 4 then we can start writing programs in arduino ide. | + | 4. then we can start writing programs in arduino ide. |
| we still make LED lights flashing, lit one second turns off one second | we still make LED lights flashing, lit one second turns off one second | ||
| + | =====Source Code===== | ||
| - | int ledPin = 10; //Defining Digital Interface 10 | + | int ledPin = 10; //Defining Digital Interface 10 |
| void setup() | void setup() | ||
| { | { | ||
| - | pinMode(ledPin, OUTPUT);//Definition of small lights interface output interface | + | pinMode(ledPin, OUTPUT); //Definition of small lights interface output interface |
| } | } | ||
| void loop() | void loop() | ||
| { | { | ||
| - | digitalWrite(ledPin, HIGH); //lit lamp | + | digitalWrite(ledPin, HIGH); //Lit lamp |
| - | delay(1000); //Delay 1 second | + | delay(1000); //Delay 1 second |
| - | digitalWrite(ledPin, LOW); //Extinguish lamp | + | digitalWrite(ledPin, LOW); //Extinguish lamp |
| - | delay(1000); // Delay 1 second | + | delay(1000); //Delay 1 second |
| } | } | ||
| | | ||
| - | |||
| - | {{:tutorials:arduino:img_20140225_160749.jpg?400|}} | ||