This week's assignment is to communicate wirelessly with a smart circuit via a Graphical User Interface (GUI) on a phone or PC.
I got my inspiration from a YouTube video. The idea is to activate the servo motor when entering a specific number in the GUI, causing the door to open. Another number will close the door and trigger a sound, simulating a doorbell.
Input: Arduino Bluetooth Control Variables
Output: ServoMotor - Buzzer
Circuit Link on Tinker CAD: https://www.tinkercad.com/things/7mhx6qrHhI1-door-bell
3. Burn the code on Arduino and test it by Serial Monitor.
1- Initialize components → (Serial.begin(9600); pinMode(buzzer, OUTPUT); myServo.attach(servo); myServo.write(0);)
2- Read incoming data → (if (Serial.available() > 0) { incomingData = Serial.read(); })
3- Close door if '3' is received → (myServo.write(0); buzzerBeep(2);)
4- Open door if '1' is received → (myServo.write(90); buzzerBeep(1);)
5- Buzzer function for beeps → digitalWrite(buzzer, HIGH); delay(500); digitalWrite(buzzer, LOW); delay(500);
Mp3 Moudule
I couldn't upload the code to the Arduino. Huda, my colleague in the Diploma, told me I had to disconnect TX and RX. After doing that, the upload worked fine.
When I tested the code on the Serial Monitor, it worked perfectly. However, when I used the Bluetooth module, the sound kept repeating nonstop.
The solution: Move the code of if conditions inside the brackets {} because the incoming data was stuck in a loop, causing it to repeat nonstop.
Credits for this solution go to our genius instructor, Yehia El Erieny.
<<<The Final Project
Title of Media