hi there
in mostly newbie with blynk
got some experiences with cayenne
arduino board / esp8266-01
but now i want to use v0 of timer to light up my lamp that i use on digital3 on my esp8266-01
thanks
hi there
in mostly newbie with blynk
got some experiences with cayenne
arduino board / esp8266-01
but now i want to use v0 of timer to light up my lamp that i use on digital3 on my esp8266-01
thanks
Start with the widget example: https://examples.blynk.cc/?board=ESP8266&shield=ESP8266%20WiFi&example=Widgets%2FTimer
In your case the ESP-01 is only used as a WiFi to TTL adapter for the Arduino, so any and all IO functions and code are connected and uploaded to the Arduino, not the ESP-01.
http://help.blynk.cc/how-to-connect-different-hardware-with-blynk/arduino/esp8266-with-at-firmware
got some experiences with cayenne
arduino board / esp8266-01
but i want to use V0 or Vsomething to light up my lamp that are on esp8266-01 that are driving a ssr on pin3…
so when Vsomething go high i want to put my pin3 on esp8266 high
i don’t know where to put
BLYNK_WRITE(V0)
{
int virtualPin0 = param.asInt(); // assigning incoming value from pin V0 to a variable
// You can also use:
// String i = param.asStr();
// double d = param.asDouble();
if (virtualPin0 == 1)
{
digitalWrite(3, HIGH);
}
else
{
digitalWrite(3, LOW);
}
}
in the timer sketch
thanks
You are either using the ESP as a standalone, or as a WiFi adapter for the UNO.
Which is it? Pin choices change depending on device used.
As for timers, they are easy to understand once the basics ar in hand… just study up on them here:
Lots of other information and examples listed here:
/*************************************************************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-library/releases/latest
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator: http://examples.blynk.cc
Blynk community: http://community.blynk.cc
Follow us: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
App project setup:
Time Input widget on V1.
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
BLYNK_WRITE(V1) {
TimeInputParam t(param);
// Process start time
if (t.hasStartTime())
{
Serial.println(String("Start: ") +
t.getStartHour() + ":" +
t.getStartMinute() + ":" +
t.getStartSecond());
}
else if (t.isStartSunrise())
{
Serial.println("Start at sunrise");
}
else if (t.isStartSunset())
{
Serial.println("Start at sunset");
}
else
{
// Do nothing
}
// Process stop time
if (t.hasStopTime())
{
Serial.println(String("Stop: ") +
t.getStopHour() + ":" +
t.getStopMinute() + ":" +
t.getStopSecond());
}
else if (t.isStopSunrise())
{
Serial.println("Stop at sunrise");
}
else if (t.isStopSunset())
{
Serial.println("Stop at sunset");
}
else
{
// Do nothing: no stop time was set
}
// Process timezone
// Timezone is already added to start/stop time
Serial.println(String("Time zone: ") + t.getTZ());
// Get timezone offset (in seconds)
Serial.println(String("Time zone offset: ") + t.getTZ_Offset());
// Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)
for (int i = 1; i <= 7; i++) {
if (t.isWeekdaySelected(i)) {
Serial.println(String("Day ") + i + " is selected");
}
}
Serial.println();
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}
i just want to activate my esp8266-01 digital pin 3 with that script
when v1 goes to 1 activate pin3 and when it goes 0 desactivate my pin3
just don’t know where to put :
if (V1 == 1)
{
digitalWrite(3, HIGH);
}
else
{
digitalWrite(3, LOW);
}
thanks to help me
You would use the Blynk Function BLYNK_WRITE(vPIN)
http://docs.blynk.cc/#blynk-firmware-virtual-pins-control-blynk_writevpin
But you are already using V1 for another function (Time Input Widget??), so you will need to use another vPin.
Also, the physical pin #3 on the ESP-01 is actually GPIO2 or D2, so you would probably need digitalWrite(2, xxx); instead.
PS, I fixed your posted code for proper vewing on this forum…
thanks
i want to use V1 (that are the start stop timer)
to set my esp pinX high when V1 goes high
tried
> (setup)
> BLYNK_WRITE(V1) {
> TimeInputParam t(param);
>
> (loop)
> if (V1 == 1)
> {
> digitalWrite(3, HIGH);
> }
> else
> {
> digitalWrite(3, LOW);
> }
>
relay always on
tried
> (setup)
> BLYNK_WRITE(V1) {
> TimeInputParam t(param)
> int virtualPin0 = param.asInt()
>
> (loop)
>
> if (virtualPin0 == 1)
> {
> digitalWrite(3, HIGH);
> }
> else
> {
> digitalWrite(3, LOW);
> }
If that is the case, then you are using the incorrect parameter (you where using the one for Time Input Widget).
You want to follow the Docs for Timer instead…
Try something like this (NOTE I changed the pin number as referenced above).
BLYNK_WRITE(V1) {
if (param.asInt() == 1) {
digitalWrite(2, HIGH);
}
else {
digitalWrite(2, LOW);
}
}
Also NOTE I had to edit your post again to properly format your posted code… Please look back at how it is to be done and don’t use >