Created
February 14, 2017 01:22
-
-
Save anonymous/e60612481f7083792d72a2592278c9c1 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
#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