Created
June 10, 2018 00:03
-
-
Save gallaugher/a25f720de49dadca91e01c62fdee6e30 to your computer and use it in GitHub Desktop.
Gallaugher - LBD Day 6
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
void setup() { | |
// put your setup code here, to run once: | |
pinMode(7, OUTPUT); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
// analogRead has possible values from 0...1023 | |
int potValue = analogRead(A0); | |
// map will take a value from 0 to 1023 and convert it between 0 and 255 | |
int mappedValue = map(potValue, 0, 1023, 0, 255); | |
// analogWrite has possible values from 0...255 | |
analogWrite(6, mappedValue); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment