Created
December 4, 2014 15:55
-
-
Save Arachnid/9acde4424fbecf744708 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 PIN 3 | |
void setup() { | |
Serial.begin(115200); | |
} | |
void loop() { | |
long last = 0; | |
boolean last_value = -1; | |
while(1) { | |
boolean value = digitalRead(PIN); | |
if(value != last_value) { | |
long now = micros(); | |
Serial.print(value); | |
Serial.print(" "); | |
Serial.println(now - last); | |
last = now; | |
last_value = value; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment