Last active
March 22, 2018 18:25
-
-
Save kmicheli/e6bd5ea6825727ee5b5c1e01d09ccd6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int pot1 = A0; //select the input pin for the potentiometer | |
int pot2 = A1; | |
int potVal1 = 0; //variable to store the value coming from the sensor | |
int potVal2 = 0; | |
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin(9600); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
potVal1 = analogRead(pot1); //read in value from potentiometer 1 | |
potVal2 = analogRead(pot2);//read in value from potentiometer 2 | |
int mappedPot1 = map(potVal1, 0, 1023, 0, 400); //map the values to fit on my canvas | |
int mappedPot2 = map(potVal2, 0, 1023, 0, 400); | |
Serial.print(mappedPot1); //print the values into serial monitor | |
Serial.print(","); | |
Serial.println(mappedPot2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment