Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int ledStatus = 0;
- //Pin assignment
- byte ledPin=12;
- void setup()
- {
- Serial.begin(9600);
- pinMode(ledPin, OUTPUT);
- }
- void loop()
- {
- Serial.print("Do you want on or off?");
- while(Serial.available()){};
- ledStatus = Serial.parseInt();
- if(ledStatus == 1){
- digitalWrite(ledPin, HIGH);
- Serial.print("You chose on");
- }
- else if (ledStatus == 0){
- digitalWrite(ledPin, LOW);
- Serial.print("You chose off");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement