Running Away Alarm Clock w/ a Motion sensor

I am trying to code/create an annoying alarm clock.

It will have 2 regular snoozes, then on the 3rd snooze, the clock moves away in a certain direction. The way to turn it off is to press the stop button, then move in front of a motion sensor attached for 30 seconds.

These are the main points...

1.) A button is used to start this entire sequence...and another button is used to snooze the alarm(buzzer)

2.) Only get 2 snoozes (1st will show a green light, 2nd will show yellow light)

3.) On the last snooze, there will be a red light, and as the alarm goes off, servos and wheels will move the alarm further away, while still beeping

4.) After pushing snooze then, a motion sensor is used, and it must detect motion for 30 seconds, before turning off the alarm

This is what I have so far...


Things I'm still trying to figure out:

  • what input (just 1 button if possible) to use so that the "clock" can move through the stages on its own. Right now I am using line 12 and entering either 1,2, or 3 for each stage
  • the code for this input
  • code for another button to "snooze" each "beep" to the next stage
  • the code for using a motion sensor to be used for 30 seconds after the alarm is turned off in the red stage.

Welcome to the forum

What possessed you to start a topic in the Uncategorised category of the forum when its description is plainly

:warning: DO NOT CREATE TOPICS IN THIS CATEGORY :warning:

Your topic has been moved to the Programming category

To add to the problem you posted pictures of your code instead of copying it here an posting it in < CODE/ > tags as advised

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.