Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Arduino.h>
- #define LED 5
- #define POT A0
- int val = 0;
- void setup()
- {
- // put your setup code here, to run once:
- pinMode(LED, OUTPUT);
- }
- void loop()
- {
- // put your main code here, to run repeatedly:
- val = analogRead(POT);
- val = map(val, 0, 1023, 0, 255);
- analogWrite(LED, val);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement