feat: connect reset pin

This commit is contained in:
eneller
2024-08-25 23:23:15 +02:00
parent ef701f51bb
commit fcf3a75918

View File

@@ -1,8 +1,10 @@
const int HEARTBEAT_MAX_DELAY_MILLIS = 20000; //this is coupled to the HEARTBEAT_INTERVAL in src/main.rs
const int PIN_SWITCH = 13;
unsigned long startTimeMillis;
void setup() {
Serial.begin(9600);
pinMode(PIN_SWITCH, OUTPUT);
waitForSerial();
//NOTE might want to replace this initialization with a check in the first loop, so we dont instantly reboot
startTimeMillis = millis();
@@ -15,19 +17,6 @@ void loop(){
if (tickMillis > HEARTBEAT_MAX_DELAY_MILLIS){rst();}
if (Serial.available() > 0) { // if something has been written to the serial port
startTimeMillis = millis();
int value = Serial.parseInt();
if(value > 0)
{
Serial.print("Number: ");
Serial.print(value);
Serial.print(", hex: ");
Serial.print(value, HEX);
Serial.print(", bin: ");
Serial.println(value, BIN);
}
}
}
@@ -35,6 +24,9 @@ void loop(){
void rst(){
//TODO connect the RST pins on the motherboard
Serial.println("Error!");
digialWrite(PIN_SWITCH, LOW);
delay(500);
digitalWrite(PIN_SWITCH, HIGH);
waitForSerial();
}