Changes between Initial Version and Version 1 of wade/embedded/arduino/example/example_1
- Timestamp:
- Dec 15, 2009, 5:21:58 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
wade/embedded/arduino/example/example_1
v1 v1 1 {{{ 2 /* 3 * 讓三顆 LED 輪流亮起來 4 */ 5 6 #define pin1 8 // 定義 LED 腳位 7 #define pin2 4 // 定義 LED 腳位 8 #define pin3 13 // 定義 LED 腳位 9 #define delay_time 1000 // 定義延遲時間 10 11 // 初始設定 12 void setup() 13 { 14 pinMode(pin1, OUTPUT); 15 pinMode(pin2, OUTPUT); 16 pinMode(pin3, OUTPUT); 17 } 18 19 // 主程式迴圈 20 void loop() 21 { 22 // pin1 閃纅 23 digitalWrite(pin1, HIGH); 24 delay(delay_time); 25 digitalWrite(r, LOW); 26 delay(delay_time); 27 28 // pin2 閃纅 29 digitalWrite(g, HIGH); 30 delay(delay_time); 31 digitalWrite(g, LOW); 32 delay(delay_time); 33 34 // pin3 閃纅 35 digitalWrite(b, HIGH); 36 delay(delay_time); 37 digitalWrite(b, LOW); 38 delay(delay_time); 39 } 40 }}}