Last active
August 29, 2015 14:21
-
-
Save catatonicTrepidation/4369fa8ee6c88e4b33b3 to your computer and use it in GitHub Desktop.
Arduino Code Combinations
This file contains hidden or 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
const int LED=9; | |
const int BUTTON1=1; | |
const int BUTTON2=2; | |
const String CODE = "ABABA"; | |
String Rec = ""; | |
int Time = millis(); | |
int Delta = 0; | |
int Time1 = 0; | |
int Time2 = 0; | |
void setup() { | |
Serial.begin(9600); | |
digitalWrite(LED,LOW); | |
pinMode(LED,OUTPUT); | |
pinMode(BUTTON1,INPUT); | |
pinMode(BUTTON2,INPUT); | |
Serial.print("A"); | |
} | |
void loop() { | |
Time = millis(); | |
Time2 = Time; | |
Delta = Time2 - Time1; | |
if(digitalRead(BUTTON2)==LOW) | |
{ | |
digitalWrite(LED,LOW); | |
} | |
else | |
{ | |
digitalWrite(LED,HIGH); | |
if(Delta > 200) | |
{ | |
Rec += "A"; | |
Serial.print("A"); | |
Time1 = Time; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment