Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // set pin numbers:
- int potPin = A0; // the number of the potentiometer pin
- int ledPin = 3; // the number of the led pin
- // variables will change:
- int potValue = 0; // variable for reading the pot value
- void setup() {
- // initialize the led pin
- pinMode(ledPin, OUTPUT);
- // initialize the Serial communication
- Serial.begin(9600);
- }
- void loop(){
- // read the value of the pot:
- potValue = analogRead(potPin);
- Serial.println(potValue);
- analogWrite(ledPin, potValue/4);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement