Guest User

Untitled

a guest
Feb 17th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. int pressure = A0;
  2. int pot = A1;
  3. int LED1 = 9;
  4. int LED2 = 10;
  5.  
  6.  
  7.  
  8. void setup()
  9. {
  10. //pinMode(LED1, OUTPUT);
  11. //pinMode(LED2, OUTPUT);
  12. Serial.begin(9600);
  13. }
  14.  
  15. void loop()
  16. {
  17. int potVal = analogRead(pot);
  18. int pressVal = analogRead(pressure);
  19. int pot1 = map(potVal, 0, 1023, 0, 255);
  20. int pressure1 = map(pressVal, 0, 1023, 0, 255);
  21.  
  22. analogWrite(LED2, pot1);
  23. analogWrite(LED1, pressure1);
  24.  
  25. Serial.print("Potentiometer value: ");
  26. Serial.print(potVal);
  27. Serial.print(", pressure value: ");
  28. Serial.println(pressVal);
  29. }
Add Comment
Please, Sign In to add comment