Skip to content

Instantly share code, notes, and snippets.

Created February 14, 2017 01:22
Show Gist options
  • Save anonymous/e60612481f7083792d72a2592278c9c1 to your computer and use it in GitHub Desktop.
Save anonymous/e60612481f7083792d72a2592278c9c1 to your computer and use it in GitHub Desktop.
#define lego 9
#define red 10
int analogValue = 0;
int analogValueB = 0;
int brightval = 0;
int brightvalB = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(lego, OUTPUT);
pinMode(red, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
analogValue = analogRead(A0);
brightval = map(analogValue, 100, 300, 255, 0);
analogWrite(lego, brightval);
Serial.println(analogValue);
analogValueB = analogRead(A1);
brightvalB = analogValueB/4;
analogWrite(red, brightvalB);
Serial.println(analogValueB);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment