the code is for a perimeter monitor that should log the time of an incursion onto a ranch, and sound an alarm or send a greeting, as required. all hardware requirements and pin connections are in the code. the WAV player is not started.
what you get for your effort is:
- an extremely accurate clock, with time zone and DST correction, UTC and local time displays, courtesy of w8bh. if you read the PDFs he tells you a great many things worth knowing.
- a debounce array that cycles through a list of pins, looking for an input that gets pulled low. if a sensor goes low, the program is sent to a place to put a handling routine. at this time, that handling routine directs to a logging routine that assembles the time of the event that triggered the system, the ID of the sensor that was triggered, and displays it on a serial monitor
regrettably, It does not log that time to an SD card, because the serial monitor gets traumatized when the SD card is initialized, or if a file is opened. it gets so bad you have to reboot the host PC to shut down the IDE.
try the code as it is, if you have the hardware. check the serial monitor. run a jumper from ground to any of the pins you leave in the debounce array, and see the output of the data logger. you have the beginning of an alarm system.
until you remove the /* and // from the SD card initialization routine, or the file name declaration. changing the serial monitor baud rate did not help.
if anyone can advise, please do.
if anyone can make the single digit pin numbers print one space to the right in the serial monitor, please share. you can change the SHORT in
the program still works, but you cant use A0 as an assignment, you have to use 14. doing this will not allow you to run PrintDigits to pad out a single digit pin number.
W8HB_CLOCK_ready_for_sd.ino (22.6 KB)