Guest User

Untitled

a guest
May 28th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. int pot1;
  2. int pot2;
  3. int btnState = 0;
  4.  
  5. int incoming;
  6.  
  7. void setup() {
  8. // put your setup code here, to run once:
  9. Serial.begin(9600);
  10. pinMode(8, INPUT);
  11. }
  12.  
  13. void loop() {
  14. // put your main code here, to run repeatedly:
  15. pot1 = analogRead(A1);
  16. pot2 = analogRead(A0);
  17. btnState = digitalRead(8);
  18.  
  19.  
  20. Serial.print(pot1);
  21. Serial.print(",");
  22. Serial.print(pot2);
  23. Serial.print(",");
  24. Serial.println(btnState);
  25. //send btnstate as part of your print message
  26.  
  27. delay(10);
  28.  
  29. if(Serial.available() > 0){
  30. incoming = Serial.read();
  31.  
  32. if(incoming == 1){
  33. digitalWrite(5, HIGH);
  34. }
  35. else{
  36. digitalWrite(5, LOW);
  37. }
  38. }
  39.  
  40.  
  41. }
Add Comment
Please, Sign In to add comment