Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <Arduino.h>
  2. #define LED 5
  3. #define POT A0
  4.  
  5. int val = 0;
  6.  
  7. void setup()
  8. {
  9.   // put your setup code here, to run once:
  10.   pinMode(LED, OUTPUT);
  11. }
  12.  
  13. void loop()
  14. {
  15.   // put your main code here, to run repeatedly:
  16.   val = analogRead(POT);
  17.   val = map(val, 0, 1023, 0, 255);
  18.   analogWrite(LED, val);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement