1. 練習第一個範例 File-Examples-Basic-Blink
2. 修改程式,變成展得比較特別的作法
3.
void setup() {
// initialize the digital pin as an output.
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(300); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(200); // wait for a second
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(200);
digitalWrite(12, LOW); // turn the LED on (HIGH is the voltage level)
delay(200);
digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100);
digitalWrite(12, LOW); // turn the LED on (HIGH is the voltage level)
delay(200);
}
void setup() { // initialize the digital pin as an output. pinMode(13, OUTPUT); pinMode(12, OUTPUT); pinMode(11, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level) delay(2000); // wait for a second digitalWrite(12, LOW); // turn the LED off by making the voltage LOW delay(200); // wait for a second digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(10); // wait for a second digitalWrite(13, LOW); // turn the LED off by making the voltage LOW delay(100); digitalWrite(11, HIGH); // turn the LED on (HIGH is the voltage level) delay(110); // wait for a second digitalWrite(11, LOW); // turn the LED off by making the voltage LOW delay(1010); }
沒有留言:
張貼留言