Advertisement
STANAANDREY

Untitled

Aug 1st, 2022
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. void checkSerial() {
  2. char Incoming_value = 0; //Variable for storing Incoming_value
  3.  
  4. if(Serial.available() > 0)
  5. {
  6. Incoming_value = Serial.read(); //Read the incoming data and store it into variable Incoming_value
  7. if (Incoming_value)
  8. Serial.print((int)Incoming_value); //Print Value of Incoming_value in Serial monitor
  9. Serial.print("\n"); //New line
  10. if(Incoming_value == '1') //Checks whether value of Incoming_value is equal to 1
  11. digitalWrite(13, HIGH); //If value is 1 then LED turns ON
  12. else if(Incoming_value == '0') //Checks whether value of Incoming_value is equal to 0
  13. digitalWrite(13, LOW); //If value is 0 then LED turns OFF
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement