Skip to content

Commit

Permalink
rebooter for IOT Relay
Browse files Browse the repository at this point in the history
  • Loading branch information
drandyhaas committed Jan 18, 2024
1 parent 81b0b95 commit 6b7e3ed
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions software/serial_rebooter/serial_rebooter.ino
Original file line number Diff line number Diff line change
@@ -0,0 1,31 @@
/*
Serial UART control of Haasoscope rebooter
Board: Arduino Nano
Processor: ATmega168
*/

void setup() {
pinMode(LED_BUILTIN, OUTPUT); // pin 13
digitalWrite(LED_BUILTIN,HIGH);
Serial.begin(9600);
Serial.println("Arduino Connected");
}

String input;
void loop() {
//USAGE: haasoscope on/off
if(Serial.available()){
input = Serial.readStringUntil('\n');
Serial.println("Read: " input);
if(input.substring(0, 10) == "haasoscope") {
if (input.substring(11,13) == "on") {
Serial.println("on");
digitalWrite(LED_BUILTIN,HIGH);
}
else if (input.substring(11,14) == "off"){
Serial.println("off");
digitalWrite(LED_BUILTIN,LOW);
}
}
}
}

0 comments on commit 6b7e3ed

Please sign in to comment.