I am a high school senior in a Project Lead the Way, engineering program, class. I am in a group of three and we are currently designing an alarm clock that is pressure sensitive. The device will look and function similar to a normal alarm except that there is no snooze or “alarm off” button. There is a pressure sensor that is placed under the mattress; this will act as the toggle on and off switch. We want the alarm to turn on when the time the alarm is set to go off is reach, as long as the pressure sensor senses that someone is on the bed. The alarm must remain on until the pressure sensor value senses that there is no one on the bed. The current problem we are having is that we need to “zero out” the pressure sensor value after the pressure sensor is placed under the mattress. We plan to “zero out” the pressure sensor value with the toggle/press and release of a button. The best way I can explain what I mean by “zero out” is by using a scale as an example. When you use a scale, digital or analog, you must first set the scales value to zero before weighing anything; in my case the pressure sensor is the scale and I need to zero it out before our design will work. In terms of programming I guess I am looking for a way to set an input value after a button PRESS.
Incorporated is my current code, in place of the alarm is the LED. Please disregard anything regarding a potentiometer; I copied various parts of various codes to make this one.
WORKING_YESSSSSSSSSSSSS_PLUS_MORE.ino (2.39 KB)