1

I recreated this project from Fritzing in my circuits.io project then on the arduino itself, it all works fine just how I wanted it.

The concept behind it is:

  1. You plug it in and the time is set to 00:00

  2. You can adjust the time to the time now let's say 22:46

  3. You can put in an alarm to wake up let's say an hour later at 23:46

  4. The piezo beeps in stops, so not continious.

So now my question is, how can I add a led that flickers on the same rhythm as the piezo (when the alarm goes off)? Can someone help me in my circuits.io project?

An update/edit would be great! I'm relatively new to all of this.

Thanks a lot!

  • That is impressive. But when it comes to actually building the thing, my opinion is that you would be better off with an actual RTC module like the DS3231. It not only holds the time even when the power is off, (once you set it with a separate program), but you can also program it to alarm and interrupt the Arduino to trigger the piezo and LED. – SDsolar May 13 '17 at 0:42
  • Also posted at reddit.com/r/arduino/comments/6atwt3/… – gre_gor May 13 '17 at 23:22
1
  • You need to add an LED and series resistor between a currently unused Arduino pin and ground.

  • In your setup() function, set that pin's i/o mode to OUTPUT.

  • Where the code turns the tone on, it should also make the LED pin HIGH.

  • Where the code turns the tone off, it should also make the LED pin LOW.

  • Why not hang it off the same pin? If the piezo is software-controlled, problem solved. I do that for my low-voltage alarms on the solar plant battery monitoring system. Of course, if the piezo is doing the sound timing internally, that would be a different problem. – SDsolar May 13 '17 at 0:39
  • That will work but the LED will run at 50% brightness - the tone() function being used in the OP's code generates a 50% duty-cycle square wave at the specified frequency. The sum of the currents drawn by the LED and the Piezo must also be within the pin-driver limits. – JRobert May 13 '17 at 1:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.