Arduino Cute Alarm

135

1

This is a simple, useful and cute Arduino project. Its function is to remind you like an alarm. I design it like a cute animal . If you want, you can make it become any cute animals you like.

Supplies:

  • Green LED x 2
  • Red LED x 2
  • Sensor x 1
  • Buzzer x1
  • Arduino Leonardo x 1

Step 1: PUT ON THE LED

First, put on your LED. One is red and one is green. Put two pairs on. One pair on D13, one pair on D11.

Step 2: The Buzzer

Then, the next step is put on the buzzer on D8

Step 3: The Sensor

After that , put on the sensor. The echoPin is on D2 and The trigPin is on D4.

Step 4: Set Up the Code

Final step for the project is set the code on Arduino.

#define echoPin 2 // Echo Pin
#define trigPin 4 // Trigger Pin int maximumRange = 200; // Maximum range needed int minimumRange = 0; // Minimum range needed long duration, distance; // Duration used to calculate distance void setup() { pinMode (8, OUTPUT); Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); } void loop() { /* The following trigPin/echoPin cycle is used to determine the distance of the nearest object by bouncing soundwaves off of it. */ digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); //Calculate the distance (in cm) based on the speed of sound. distance = duration/58.2; Serial.println(distance); if (distance <= 50 )//更改距離,原為50 { // Serial.println(distance); digitalWrite(13, HIGH);//改 (此為新增的Code) digitalWrite(11, LOW);//改 (此為新增的Code) tone(8, 1050); //改 (更改音頻) delay(1000); //改 (更改間隔時間) tone(8,800); delay(1000);//改 (更改音頻) delay(100); //改 (更改間隔時間)//改 (更改間隔時間) } else { digitalWrite(13, LOW);//改 (此為新增的Code) digitalWrite(11, HIGH);//改 (此為新增的Code) noTone(8); } //Delay 50ms before next reading. delay(50); }

Step 5: About the Exterior

If you want to make the exterior, you can do what ever you want. I my project, I made ti like a dog with the sensor eye and LED ears.

Step 6: Video

Sensors Contest

This is an entry in the
Sensors Contest

Share

    Recommendations

    • Pets Challenge

      Pets Challenge
    • Beauty Tips Contest

      Beauty Tips Contest
    • Backyard Contest

      Backyard Contest

    Discussions