Advertisement
Guest User

Untitled

a guest
Jan 14th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. const int bluePin=9;
  2. const int redPin=11;
  3. const int greenPin=10;
  4. const int potPin=A0;
  5. const int potPin2=A1;
  6. const int potPin3=A2;
  7. int readVal;
  8. int readVal2;
  9. int readVal3;
  10. void setup()
  11. {
  12. pinMode(potPin,INPUT);
  13. pinMode(potPin2, INPUT);
  14. pinMode(potPin3,INPUT);
  15. pinMode(greenPin,OUTPUT);
  16. pinMode(redPin,OUTPUT);
  17. pinMode(bluePin,OUTPUT);
  18. Serial.begin(9600);
  19.  
  20. }
  21.  
  22. void loop()
  23. {
  24. readVal=analogRead(potPin);
  25. readVal2=analogRead(potPin2);
  26. readVal3=analogRead(potPin3);
  27. readVal=map(readVal, 0,1023,255,0);
  28. Serial.println(readVal);
  29. analogWrite(redPin, readVal);
  30. delay(5);
  31. readVal2=map(readVal2, 0,1023,255,0);
  32. Serial.println(readVal2);
  33. analogWrite(greenPin, readVal2);
  34. delay(5);
  35. readVal3=map(readVal3, 0,1023,255,0);
  36. Serial.println(readVal3);
  37. analogWrite(bluePin, readVal3);
  38. delay(5);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement