Added verbose serial output and named pins.
This commit is contained in:
parent
44423a0b16
commit
3066ac73cd
@ -1,24 +1,38 @@
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/sleep.h>
|
||||
|
||||
// Define relais pins
|
||||
#define relaisPin_1 12
|
||||
#define relaisPin_2 13
|
||||
|
||||
void setup() {
|
||||
// Define relais pins
|
||||
pinMode(19, OUTPUT);
|
||||
pinMode(20, OUTPUT);
|
||||
Serial.begin(9600); // open the serial port at 9600 bps
|
||||
|
||||
pinMode(relaisPin_1, OUTPUT);
|
||||
pinMode(relaisPin_2, OUTPUT);
|
||||
|
||||
Serial.println("Hello!");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
delay(2000); // Wait for 2 seconds
|
||||
digitalWrite(19, HIGH); // Poweron Relais #1
|
||||
Serial.println("Enable power rail #1");
|
||||
digitalWrite(relaisPin_1, HIGH); // Poweron relais #1
|
||||
|
||||
delay(2000);
|
||||
digitalWrite(20, HIGH); // Poweron Relais #2
|
||||
Serial.println("Enable power rail #2");
|
||||
digitalWrite(relaisPin_2, HIGH); // Poweron relais #2
|
||||
|
||||
delay(50); // wait for UART to finish
|
||||
stop();
|
||||
}
|
||||
|
||||
void stop() {
|
||||
// Send microcontroller to sleep
|
||||
// Turn microcontroller off
|
||||
Serial.println("All done, powering off. Goodbye.");
|
||||
delay(100); // wait for UART to finish
|
||||
|
||||
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
|
||||
cli();
|
||||
sleep_mode();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user