Arduino Projects: Difference between revisions
→Versatile Kitchen Timer: added code
(→Time and Gas Sensor with Display: added sketch) |
(→Versatile Kitchen Timer: added code) |
||
Line 93:
[[File:Kitchen Versatile Timer.jpg|thumb|right|Kitchen Versatile Timer]]
<pre style="width: 75%; height: 10pc; overflow-y: scroll;">
//This code is written by Amandeep Singh
const int outpin = 9; // Buzzer Pin
int pin1 = 2; //Switch Pins
int pin2 = 3; //Switch Pins
int pin3 = 4; //Switch Pins
int pin4 = 5; //Switch Pins
int button = 0; //initial button state
void beeptone()
{
tone(outpin, 500, 500);
delay(100);
tone(outpin, 1000, 500);
delay(100);
tone(outpin, 1500, 500);
delay(100);
tone(outpin, 2000, 500);
delay(100);
}
void setup()
{
pinMode(pin1, INPUT_PULLUP);
pinMode(pin2, INPUT_PULLUP);
pinMode(pin3, INPUT_PULLUP);
pinMode(pin4, INPUT_PULLUP);
}
void loop()
{
button = digitalRead(pin1);
if (button == LOW)
{
delay(5*60*1000); // 5 Minute timer
for (int i=0; i<= 50; i++){
beeptone();
}
}
button = digitalRead(pin2);
if (button == LOW)
{
delay(10*60*1000); // 10 Minute timer
for (int i=0; i<= 50; i++){
beeptone();
}
}
button = digitalRead(pin3);
if (button == LOW)
{
delay(30*60*1000); // 30 Minute timer
for (int i=0; i<= 50; i++){
beeptone();
}
}
button = digitalRead(pin4);
if (button == LOW)
{
delay(60*60*1000); // 1 Hour timer
for (int i=0; i<= 50; i++){
beeptone();
}
}
}
</pre>
=Game of Thrones=
|