Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. int potPin = 0; // select the input pin for the potentiometer
  2. int ledPin = 13; // select the pin for the LED
  3. int val = 0; // variable to store the value coming from the sensor
  4.  
  5. void setup() {
  6. pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
  7. Serial.begin(9600);
  8. }
  9.  
  10. void loop() {
  11. val = analogRead(potPin);
  12. val = map(val, 0, 1023, 0, 10);
  13. Serial.println(val);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement