|
#include <WiFiNINA.h>
char blink_flag = 0;
void setup() {
pinMode(LEDB, OUTPUT);
pinMode(LEDR,OUTPUT);
pinMode(LEDG,OUTPUT);
digitalWrite(LEDB,LOW);
digitalWrite(LEDR,LOW);
digitalWrite(LEDG,LOW);
Serial.println("Hello DigiKey & EEWorld!");
Serial.println();
Serial.begin(9600);
while (!Serial);
}
void led_blink(void) {
if(blink_flag) {
digitalWrite(LEDB, LOW);
digitalWrite(LEDR, LOW);
digitalWrite(LEDG, LOW);
} else {
digitalWrite(LEDB, HIGH);
digitalWrite(LEDR, HIGH);
digitalWrite(LEDG, HIGH);
}
blink_flag = !blink_flag;
delay(1000);
}
void loop() {
led_blink();
}
总结