Advertisement
goncharn20

Untitled

Jun 19th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. const int ledPinW= 3;
  2. const int ledPinB= 5;
  3. const int ledPinG= 6;
  4. const int Pot= A0;
  5. int potVal;
  6.  
  7.  
  8. void setup() {
  9. // put your setup code here, to run once:
  10. pinMode (ledPinW, OUTPUT);
  11. pinMode (ledPinB, OUTPUT);
  12. pinMode (ledPinG, OUTPUT);
  13. pinMode (Pot, INPUT);
  14. Serial. begin (9600);
  15. }
  16.  
  17. void loop() {
  18. // put your main code here, to run repeatedly:
  19. potVal= analogRead (Pot);
  20. potVal= map (potVal, 0, 1023, 0, 200);
  21. analogWrite(ledPinW, potVal);
  22. analogWrite(ledPinB, potVal);
  23. analogWrite(ledPinG, potVal);
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement