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 8 | |
int cumulative_time = 0; | |
int MAX_DURATION = 500 * 1000; | |
byte timeD[5000]; | |
String signalR = ""; | |
void setup() { | |
pinMode(pIn, INPUT); | |
Serial.begin(9600); | |
} | |
void loop() { | |
long beginning_time = micros() / 1000; | |
for ( int i = 0; cumulative_time < MAX_DURATION; i++) { | |
int time_delta = micros() / 1000 - beginning_time; | |
timeD[i] = (time_delta); | |
signalR += digitalRead(pIn); | |
cumulative_time = time_delta; | |
} | |
for(int i=0;i<signalR.length();i++){ | |
Serial.println(timeD[i],signalR[i]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment