(22/03/2021 - 26/03/2021)
Activity :
1. FYP2 Briefing : thesis Writing Workshop (Chapter 4, Chapter 5, Abstract)
2. Generate coding for NodeMCU ESP8266
Objective :
1. To participate in the FYP2 Briefing
2. To generate coding for NodeMCU ESP8266 notification
Content / Procedure :
FYP2 Briefing : thesis Writing Workshop (Chapter 4, Chapter 5, Abstract)
This week, FYP students have to attend FYP Briefing on thesis writing for Abstract, Chapter 4, and Chapter 5. The speaker is Sir Ahmad Syukri bin Mohamad.
Generate coding for NodeMCU ESP8266
This week, I continue working on generating the coding for NodeMCU ESP8266 by using Arduino IDE. I am using the same coding I'm using to test the ESP8266 but need to change the auth token code that has been sent to the email and add some coding to connect with Arduino Nano.
Code :
1. To be added to Arduino NANO code
#include <SoftwareSerial.h>
SoftwareSerial s(8,9);
2. To be upload to NodeMCU ESP8266
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SoftwareSerial.h>
SoftwareSerial s(D5,D6);
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "iKxmJo4xFvZfZNYJrAzsp3Rbry0ys_ 7K";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "********";
char pass[] = "*********";
int data;
int flag;
void setup()
{
s.begin(9600);
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}
void loop()
{
Blynk.run();
s.write("s");
data=s.read();
Serial.println(data);
if (data == 50)
{
Serial.print("xxxx");
delay(1000);
if(flag == 0)
{
Blynk.notify("Medicine have been delivered");
Serial.print("yyyy");
flag = 1;
data = 0;
}
}
else
{
flag = 0;
}
delay (300);
}
Conclusion :
As a result, I am able to complete the coding for the ESP8266 notification. I will continue my project by generating code for ESP32-Cam next week.
Comments
Post a Comment