Created
February 25, 2013 02:19
-
-
Save L1fescape/5026942 to your computer and use it in GitHub Desktop.
Code from Arduino Demultiplexer and Potentiometer video http://youtu.be/tRjOoweOEaU
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 sensorPin = A0; | |
int delayAmt = 0; | |
int led = 13; //just a led | |
void setup(){ | |
pinMode(2, OUTPUT); | |
pinMode(3, OUTPUT); | |
pinMode(4, OUTPUT); | |
pinMode(led, OUTPUT); | |
digitalWrite(led, HIGH); | |
Serial.begin(9600); | |
} | |
void loop () { | |
delayAmt = analogRead(sensorPin); | |
digitalWrite(2, 0); | |
digitalWrite(3, 1); | |
digitalWrite(4, 1); | |
delay(delayAmt); | |
delayAmt = analogRead(sensorPin); | |
digitalWrite(2, 0); | |
digitalWrite(3, 0); | |
digitalWrite(4, 0); | |
delay(delayAmt); | |
delayAmt = analogRead(sensorPin); | |
digitalWrite(2, 0); | |
digitalWrite(3, 0); | |
digitalWrite(4, 1); | |
delay(delayAmt); | |
delayAmt = analogRead(sensorPin); | |
digitalWrite(2, 0); | |
digitalWrite(3, 1); | |
digitalWrite(4, 0); | |
delay(delayAmt); | |
delayAmt = analogRead(sensorPin); | |
digitalWrite(2, 1); | |
digitalWrite(3, 0); | |
digitalWrite(4, 1); | |
delay(delayAmt); | |
delayAmt = analogRead(sensorPin); | |
digitalWrite(2, 1); | |
digitalWrite(3, 1); | |
digitalWrite(4, 1); | |
delay(delayAmt); | |
delayAmt = analogRead(sensorPin); | |
digitalWrite(2, 1); | |
digitalWrite(3, 1); | |
digitalWrite(4, 0); | |
delay(delayAmt); | |
delayAmt = analogRead(sensorPin); | |
digitalWrite(2, 1); | |
digitalWrite(3, 0); | |
digitalWrite(4, 0); | |
delay(delayAmt); | |
delayAmt = analogRead(sensorPin); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment