FYP 2, WEEK 6 (10/4/2023 - 14/4/2023)
After feeling confident about the programming of all the main components, I proceeded to incorporate the programming for the Blynk application. Since the primary function of the Blynk integration was to send notifications, I decided to address this IoT programming aspect towards the final stages of my project. I began by incorporating the Blynk code into the finalized programming structure.
Through this process, I discovered the significant advantages of utilizing the ESP32 for IoT data transfer tasks. The ESP32's built-in Bluetooth and Wi-Fi features eliminated the need for an external Wi-Fi module, simplifying the overall implementation. This realization further emphasized the ESP32's capability in streamlining IoT-related functionalities.
The code added for the Blynk integration is as follows:
#include <BlynkSimpleEsp32.h>
#define BLYNK_AUTH "your_blynk_auth_token" #define FIREBASE_HOST "atm-machine-9a17b-default-rtdb.firebaseio.com" #define FIREBASE_AUTH "1TtNFcQ5D9Mpzh8M58CcVANSaor7e8pyBZV6M2Se" #define WIFI_SSID "iphone KHAIRUL" #define WIFI_PASSWORD "635599naz" #define BLYNK_TEMPLATE_ID "TMPL61Hk0WINe" #define BLYNK_TEMPLATE_NAME "EMERGENCY NOTIFICATION" #define BLYNK_AUTH_TOKEN "Aaz7Fm19aviUM2c-qgdP48uw7oA-mYET"
void handleAlarmState() {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("ALARM! Notify Admin");
Blynk.logEvent("Emergency Alert!!, Emergency at UNIKL BMI") ;
Serial.println("Alarm!!");
Comments
Post a Comment