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 NPIN = 2; // pin count | |
const int PINS[NPIN] = {2, 3}; // input pins | |
volatile long long t0 = 0, t[2] = {0}; | |
void edge_function(int pin) { | |
byte level = digitalRead(PINS[pin]); | |
if(level && pin == 0) { // react to up edge of only pin 0. | |
t0 = micros(); | |
Serial.print((int)t[0]); |
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
#include <EEPROM.h> | |
#define CLEAR_BUTTON (2) | |
#define MAX_LOG_N (120) | |
struct run_log_t { | |
uint8_t last_index; | |
uint16_t duration[MAX_LOG_N]; | |
}; | |
uint8_t index; |