1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | char val; void setup() { Serial.begin(9600); pinMode(13, OUTPUT); } void loop() { val = Serial.read(); if(val=='1'){ digitalWrite(13, HIGH); } if(val=='0'){ digitalWrite(13, LOW); } } |
