Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. const byte led = 13;
  2. int inByte = -1;
  3. int outByte =-1;
  4.  
  5. void setup() {
  6. Serial.begin(9600);
  7. pinMode(13, OUTPUT);
  8. pinMode(A0, INPUT);
  9. }
  10.  
  11. void loop() {
  12. if (Serial.available())
  13. {
  14. inByte = Serial.read() - '0'; //converting ascii value to integer
  15. if (inByte == 1)
  16. {
  17. digitalWrite(led, HIGH);
  18. } else {
  19. digitalWrite(led, LOW);
  20. }
  21. }
  22. outByte= analogRead(A0);
  23. Serial.write(outByte);
  24. delay(25);
  25. }