MEET SUPERVISOR/RESEARCH
Date: 1/4/2019 (Monday) – 5/4/2019 (Friday)
In this week researching and learning about
programming that to program at Arduino.
programming Arduino
with WiFi Module
In this week I have done the
coding which can able the Arduino to detect the Wi-Fi module and function.
Coding ESP 8266
#define BLYNK_PRINT
Serial
#include
<ESP8266_Lib.h>
#include
<BlynkSimpleShieldEsp8266.h>
// You should get Auth
Token in the Blynk App.
// Go to the Project
Settings (nut icon).
char auth[] = "0a1489965299490f81617ae2f8fab3d1";
// Your WiFi credentials.
// Set password to
"" for open networks.
char ssid[] =
"AndroidAP";
char pass[] =
"imun0030";
// Hardware Serial on
Mega, Leonardo, Micro...
//#define EspSerial
Serial1
// or Software Serial on
Uno, Nano...
#include <SoftwareSerial.h>
SoftwareSerial
EspSerial(2, 3); // RX, TX
// Your ESP8266 baud
rate:
#define ESP8266_BAUD 9600
ESP8266
wifi(&EspSerial);
BlynkTimer timer;
// This function sends
Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading
frequency should be set to PUSH. This means
// that you define how
often to send data to Blynk App.
void myTimerEvent()
{
// You can send
any value at any time.
// Please don't
send more that 10 values per second.
Blynk.virtualWrite(V5, millis() / 1000);
}
void setup()
{
// Debug console
Serial.begin(9600);
// Set ESP8266
baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth,
wifi, ssid, pass);
// You can also
specify server:
//Blynk.begin(auth, wifi, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);
// Setup a
function to be called every second
timer.setInterval(1000L, myTimerEvent);
}
void loop()
{
Blynk.run();
timer.run(); //
Initiates BlynkTimer
}


No comments:
Post a Comment