Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup()
- {
- Serial.begin(9600);
- pinMode(13,OUTPUT);
- pinMode(12,INPUT);
- }
- void loop()
- {
- if (Serial.available() > 0) {
- if (Serial.read() == 65) {
- commuta();
- }
- }
- if (!digitalRead(12)) {
- delay(100);
- while (!digitalRead(12));
- commuta();
- }
- }
- void commuta() {
- digitalWrite(13,!digitalRead(13));
- Serial.print("Commuto! ");
- Serial.print("Adesso il LED e': ");
- if (digitalRead(13)) {
- Serial.println("Acceso");
- } else {
- Serial.println("Spento");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement