#define LED1 13 //內部的LED
#define LED2 8 //自己接的
void setup(){
Serial.begin(9600);
pinMode(LED2, OUTPUT);
pinMode(LED1, OUTPUT);
}
void toogle( int pin ) {
digitalWrite(pin, !digitalRead(pin));
digitalWrite(pin, !digitalRead(pin));
}
void loop(){
static int old1 = 0, i=0;
if ( millis()-old1 >= 200 ) { //200mS
old1 = millis();
toogle(LED1);
toogle(LED2);
Serial.println("\n Hello world---" + String(i++));
}
}