This commit is contained in:
James Devine 2017-10-02 20:05:36 +02:00 committed by GitHub
parent 25802160d7
commit 771926c3f6

View file

@ -48,11 +48,14 @@ byte thresh1;
byte thresh2;
unsigned long timemeasure;
unsigned long timeoffset;
float instarate;
unsigned long event_count = 0;
extern volatile unsigned long timer0_millis;
unsigned long new_value=0;
void setup() {
//setup analogue writemode
@ -73,6 +76,8 @@ void setup() {
Serial.print("Setting HV to: ");
Serial.println(HV_val);
bitBang(HV_val);
timeoffset = 0;
}
void loop() {
@ -106,7 +111,8 @@ void loop() {
}
case 3:
event_count = 0;
Serial.println("Event counter set to 0!");
timeoffset = millis();
Serial.println("Event counter and timer set to 0!");
break;
}
@ -237,7 +243,10 @@ void printTimeAndPin(int pin, String name){
event_count++;
Serial.print(name);
Serial.print(";count=");
Serial.println(event_count);
Serial.print(event_count);
Serial.print(";time=");
timemeasure=millis();
Serial.println(timemeasure-timeoffset);
/* This code works out the instant rate and prints it as well. more likely to cause crashes as it's in the interrupt.
Serial.print(";time=");
timemeasure = millis();