Skip to content

Instantly share code, notes, and snippets.

@gallaugher
Created June 10, 2018 00:03
Show Gist options
  • Save gallaugher/a25f720de49dadca91e01c62fdee6e30 to your computer and use it in GitHub Desktop.
Save gallaugher/a25f720de49dadca91e01c62fdee6e30 to your computer and use it in GitHub Desktop.
Gallaugher - LBD Day 6
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