Make debug output switchable.
This commit is contained in:
parent
3066ac73cd
commit
88301c8a67
@ -1,6 +1,14 @@
|
|||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
#include <avr/sleep.h>
|
#include <avr/sleep.h>
|
||||||
|
|
||||||
|
#define DEBUG 1
|
||||||
|
|
||||||
|
#if DEBUG == 1
|
||||||
|
#define Debugln(x) Serial.println(x)
|
||||||
|
#else
|
||||||
|
#define Debugln(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Define relais pins
|
// Define relais pins
|
||||||
#define relaisPin_1 12
|
#define relaisPin_1 12
|
||||||
#define relaisPin_2 13
|
#define relaisPin_2 13
|
||||||
@ -11,16 +19,16 @@ void setup() {
|
|||||||
pinMode(relaisPin_1, OUTPUT);
|
pinMode(relaisPin_1, OUTPUT);
|
||||||
pinMode(relaisPin_2, OUTPUT);
|
pinMode(relaisPin_2, OUTPUT);
|
||||||
|
|
||||||
Serial.println("Hello!");
|
Debugln("Hello!");
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
delay(2000); // Wait for 2 seconds
|
delay(2000); // Wait for 2 seconds
|
||||||
Serial.println("Enable power rail #1");
|
Debugln("Enable power rail #1");
|
||||||
digitalWrite(relaisPin_1, HIGH); // Poweron relais #1
|
digitalWrite(relaisPin_1, HIGH); // Poweron relais #1
|
||||||
|
|
||||||
delay(2000);
|
delay(2000);
|
||||||
Serial.println("Enable power rail #2");
|
Debugln("Enable power rail #2");
|
||||||
digitalWrite(relaisPin_2, HIGH); // Poweron relais #2
|
digitalWrite(relaisPin_2, HIGH); // Poweron relais #2
|
||||||
|
|
||||||
delay(50); // wait for UART to finish
|
delay(50); // wait for UART to finish
|
||||||
@ -29,7 +37,7 @@ void loop() {
|
|||||||
|
|
||||||
void stop() {
|
void stop() {
|
||||||
// Turn microcontroller off
|
// Turn microcontroller off
|
||||||
Serial.println("All done, powering off. Goodbye.");
|
Debugln("All done, powering off. Goodbye.");
|
||||||
delay(100); // wait for UART to finish
|
delay(100); // wait for UART to finish
|
||||||
|
|
||||||
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
|
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
|
||||||
|
Loading…
Reference in New Issue
Block a user