And check your spelling, no little r in TIMER
Also, while you donāt appear to be using the serial monitor⦠you have an extra 0 in the BAUD rate should be only 115200
And check your spelling, no little r in TIMER
Also, while you donāt appear to be using the serial monitor⦠you have an extra 0 in the BAUD rate should be only 115200
@Tom for reference with each instance of SimpleTimer i.e. GarageTimer you can have up to 10 functions / subroutines. In your case I think you only need one function / subroutine but has you develop your projects you will need more functions / subroutines but not normally more than one instance of SimpleTimer unless it is a very complex project.
So an example of the lines required for general use of SimpleTimer, with all the Blynk stuff excluded would be:
// Blynk libraries for your specific connection method go here
#include <SimpleTimer.h>
SimpleTimer GarageTimer
void setup() {
// put your Blynk connection code here
GarageTimer.setInterval(1000L, function1); // do something at 1s intervals
GarageTimer.setInterval(5000L, function2); // do something at 5s intervals
// more functions / subroutines if required
GarageTimer.setInterval(30000L, function10); // do something at 30s intervals
}
void function1(){
// some code here
}
void function2(){
// some code here
}
void function10(){
// some code here
}
void loop() {
// normally just Blynk.run() here
GarageTimer.run()
}
You wouldnāt use names like function1, function2 though, obviously something meaningful based on what the function does.
And now?
Regarding V5, what i have to set to V5 in Blynk App?
LCD Display i have to set for PUSH, but only LCD?
#include <SimpleTimer.h>
char auth[] = "********************";
char ssid[] = "*******";
char pass[] = "************";
WidgetLED led1(V2);//
WidgetLED led2(V3);//
WidgetLCD lcd(V4);
SimpleTimer GarageTIMER;
/////////////////////////setup////////////////////////////////////////////
void setup()
{
Serial.begin(1152000);
Blynk.begin(auth, ssid, pass);
pinMode(13,OUTPUT); //
pinMode(4,INPUT_PULLUP);
GarageTIMER.setInterval(1000L, sensorcheck);
}
BLYNK_WRITE(V1)
{
if (param.asInt() == 0)
{
digitalWrite(13, LOW); //GPIO13
}
else
{
digitalWrite(13, HIGH); // GPIO13
}
}
/////////////////////////sensorcheck////////////////////////////////////////////
void sensorcheck()
{
if (digitalRead(4)) // GPIO4
{
led1.off();
led2.off();
} else {
led1.on();
led2.on();
}
{
int garageSensorSW = digitalRead(4); // GPIO4
if (garageSensorSW == LOW)
{
lcd.print(1, 0, "GARAGE IS CLOSED"); // LCD print, column 1, row 0.
}
else
{
lcd.print(1, 0, "GARAGE IS OPEN"); // LCD print, column 1, row 0
}
blynk.virtualWrite(V5, millis() / 1000); //do i need this line, and what is V5 in Blynk App?
}
/////////////////////////loop////////////////////////////////////////////
void loop()
{
Blynk.run();
GarageTIMER.run()
}
You donāt need the V5 it is just an example. In the example sketch you would have a value display widget on V5 and it would update (like a clock) every second. Comment it out.
Your sketch looks much better but you are missing all your Blynk libraries.
okay i will add the libaries and then i hope it runs.
Regarding V5, so i can remove the following line?
blynk.virtualWrite(V5, millis() / 1000);
Yes that line can be removed. For reference everything is case sensitive so Blynk.virtualWrite not blynk.virtualWrite.
Thank you Costas. I will try i will report in the evening.
Can you tell me what is my problem?
Garage_1:116: error: expected ā}ā at end of input
}
^
exit status 1
invalid conversion from āvoid (*)()ā to āintā [-fpermissive]
I think around line 116 you are missing a closing bracket }
Can you post your code and I will check in my compiler.
But where?
Can i switch on line number in arduino?
void setup()
{
Serial.begin(1152000);
Blynk.begin(auth, ssid, pass);
pinMode(13,OUTPUT); //
pinMode(4,INPUT_PULLUP);
GarageTIMER.setInterval(1000L, sensorcheck);
}
line 116 is my last line in my programm you find as written tomorrow morning.
here i close with }
In File, Preferences there is a tick box.
Just means the error is somewhere else, the compiler messages can be a bit cryptic at times.
void loop()
{
Blynk.run();
GarageTIMER.run()
}
should be:
void loop()
{
Blynk.run();
GarageTIMER.run(); // you missed the ;
}
i have added the ; but no function.
perhaps i have a problem with the libary simpletimer. I go to github, copy the libery.h and libary.cpp the complete content i copy in two files and safe, or?
You must install SIX libraries manually as per the release notes at https://github.com/blynkkk/blynk-library/releases/tag/v0.4.4
You donāt have to setup the /tools/⦠just now.
GREAT, it works!!! Thanks for your support costas!!!
One question regarding API, if i want to trigger from world wide, do i have to give free an port from my router?
No just make the API calls as per the docs.
Yes that shows you what to put in a browser, curl, PHP etc to control your hardware if you donāt want to use the fantastic Blynk app.