Before this happens, i insert the SimpleTimer Library from the Github and include the library in the coding, but it is no recognised when i deleted the coding and back to this one and
this appear “Error Compiling for Board Arduino/Genuino or Mega 2560”
how to fix this?
#include <BlynkSimpleStream.h>
BlynkTimer timer;
char auth[] = "cabb6d95d9804956b25f9e4553fc10b8";
int GreenMe =4 ;
int YellowMe =3 ;
int RedMe =2 ;
int EchoMe =22 ;
int TrigMe =23 ;
float pingUS1 ;
float targetDUS1;
String GarbageCaps1me="The Garbage Capacity for Metal is 0%";
String GarbageCaps2me="The Garbage Capacity for Metal is 50%";
String GarbageCaps3me="The Garbage Capacity is for Metal 100%";
int GreenNo =10;
int YellowNo =9;
int RedNo =8;
int EchoNo =26;
int TrigNo =27;
float pingUS2;
float targetDUS2;
String GarbageCaps1no="The Garbage Capacity for Non-Metal is 0%";
String GarbageCaps2no="The Garbage Capacity is Non-Metal 50%";
String GarbageCaps3no="The Garbage Capacity is Non-Metal 100%";
float speedOfSound=776.5;
String GarbageLCD="Garbage Capacity";
BLYNK_WRITE(V10)
BLYNK_WRITE(V12)
void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
Blynk.begin(Serial, auth);
pinMode(EchoMe, INPUT);
pinMode(TrigMe, OUTPUT);
pinMode(EchoNo, INPUT);
pinMode(TrigNo, OUTPUT);
timer.setInterval(1000, USMe, USNo);
}
void USMe()
{
digitalWrite(TrigMe, LOW);
delayMicroseconds(100);
digitalWrite(TrigMe, HIGH);
delayMicroseconds(20);
digitalWrite(TrigMe, LOW);
pingUS1 = pulseIn(EchoMe, HIGH);
pingUS1 = pingUS1/1000000;
pingUS1 = pingUS1/3600;
targetDUS1 = speedOfSound*pingUS1;
targetDUS1 = targetDUS1/2;
targetDUS1 = targetDUS1*63360;
targetDUS1 = targetDUS1*2.54;
Serial.print("The distance to the trash is: ");
Serial.print(targetDUS1);
Serial.println(" centimeters");
delay(1000);
Blynk.virtualWrite(V10, targetDUS1);
if (targetDUS1 < 10)
{
Serial.println(GarbageCaps3me);
analogWrite(RedMe, 250);
delay(1000);
analogWrite(RedMe, 0);
delay(100);
}
if (targetDUS1 >= 11 && targetDUS1 <= 20)
{
Serial.println(GarbageCaps2me);
analogWrite(YellowMe, 250);
delay(1000);
analogWrite(YellowMe, 0);
delay(100);
}
if (targetDUS1 >20)
{
Serial.print(GarbageCaps1me);
analogWrite(GreenMe, 250);
delay(1000);
analogWrite(GreenMe, 0);
delay(100);
}
}
void USNo()
{
digitalWrite(TrigNo, LOW);
delayMicroseconds(100);
digitalWrite(TrigNo, HIGH);
delayMicroseconds(20);
digitalWrite(TrigNo, LOW);
pingUS2 = pulseIn(EchoNo, HIGH);
pingUS2 = pingUS2/1000000;
pingUS2 = pingUS2/3600;
targetDUS2 = speedOfSound*pingUS2;
targetDUS2 = targetDUS2/2;
targetDUS2 = targetDUS2*63360;
targetDUS2 = targetDUS2*2.54;
Serial.print("The distance to the trash is: ");
Serial.print(targetDUS2);
Serial.println(" centimeters");
delay(1000);
Blynk.virtualWrite(V12, targetDUS2);
if (targetDUS2 < 10)
{
Serial.println(GarbageCaps3no);
analogWrite(RedNo, 250);
delay(1000);
analogWrite(RedNo, 0);
delay(100);
}
if (targetDUS2 >= 11 && targetDUS2 <= 20)
{
Serial.println(GarbageCaps2no);
analogWrite(YellowNo, 250);
delay(1000);
analogWrite(YellowNo, 0);
delay(100);
}
if (targetDUS2 >20)
{
Serial.print(GarbageCaps1no);
analogWrite(GreenNo, 250);
delay(1000);
analogWrite(GreenNo, 0);
delay(100);
}
}
void loop()
{
USMe();
USNo();
delay(1000);
Blynk.run();
timer.run();
}
@RavenLeox As per your prior account @Shfq_Slmt and post on same issue… it was automatically blocked due to “typing to fast”… AKA probably copy pasting everything in one shot on a new account? Or other activity?
After removing the Blynk Write V10 and V12 as you mentioned, the other problem is that the gauge/visual display that i placed in the blynk apps did not work
even with all the delay is erased and the Blynk Virtual write is placed under the void of USMe and USNo but still, no output on the blynk apps and my LED is not working/blinking without the delay
#define BLYNK_PRINT Serial1
#include <BlynkSimpleStream.h>
BlynkTimer timer;
char auth[] = "cabb6d95d9804956b25f9e4553fc10b8";
int GreenMe =4 ;
int YellowMe =3 ;
int RedMe =2 ;
int EchoMe =22 ;
int TrigMe =23 ;
float pingUS1 ;
float targetDUS1;
String GarbageCaps1me="The Garbage Capacity for Metal is 0%";
String GarbageCaps2me="The Garbage Capacity for Metal is 50%";
String GarbageCaps3me="The Garbage Capacity is for Metal 100%";
int GreenNo =10;
int YellowNo =9;
int RedNo =8;
int EchoNo =26;
int TrigNo =27;
float pingUS2;
float targetDUS2;
String GarbageCaps1no="The Garbage Capacity for Non-Metal is 0%";
String GarbageCaps2no="The Garbage Capacity is Non-Metal 50%";
String GarbageCaps3no="The Garbage Capacity is Non-Metal 100%";
float speedOfSound=776.5;
String GarbageLCD="Garbage Capacity";
void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
Blynk.begin(Serial, auth);
pinMode(EchoMe, INPUT);
pinMode(TrigMe, OUTPUT);
pinMode(EchoNo, INPUT);
pinMode(TrigNo, OUTPUT);
timer.setInterval(1000L, USMe);
timer.setInterval(1000L, USNo);
}
void USMe()
{
digitalWrite(TrigMe, LOW);
delayMicroseconds(100);
digitalWrite(TrigMe, HIGH);
delayMicroseconds(20);
digitalWrite(TrigMe, LOW);
pingUS1 = pulseIn(EchoMe, HIGH);
pingUS1 = pingUS1/1000000;
pingUS1 = pingUS1/3600;
targetDUS1 = speedOfSound*pingUS1;
targetDUS1 = targetDUS1/2;
targetDUS1 = targetDUS1*63360;
targetDUS1 = targetDUS1*2.54;
Serial.print("The distance to the trash is: ");
Serial.print(targetDUS1);
Serial.println(" centimeters");
Blynk.virtualWrite(V10, targetDUS1);
if (targetDUS1 < 10)
{
Serial.println(GarbageCaps3me);
analogWrite(RedMe, 250);
analogWrite(RedMe, 0);
}
if (targetDUS1 >= 11 && targetDUS1 <= 20)
{
Serial.println(GarbageCaps2me);
analogWrite(YellowMe, 250);
analogWrite(YellowMe, 0);
}
if (targetDUS1 >20)
{
Serial.print(GarbageCaps1me);
analogWrite(GreenMe, 250);
analogWrite(GreenMe, 0);
}
}
void USNo()
{
digitalWrite(TrigNo, LOW);
delayMicroseconds(100);
digitalWrite(TrigNo, HIGH);
delayMicroseconds(20);
digitalWrite(TrigNo, LOW);
pingUS2 = pulseIn(EchoNo, HIGH);
pingUS2 = pingUS2/1000000;
pingUS2 = pingUS2/3600;
targetDUS2 = speedOfSound*pingUS2;
targetDUS2 = targetDUS2/2;
targetDUS2 = targetDUS2*63360;
targetDUS2 = targetDUS2*2.54;
Serial.print("The distance to the trash is: ");
Serial.print(targetDUS2);
Serial.println(" centimeters");
Blynk.virtualWrite(V12, targetDUS2);
if (targetDUS2 < 10)
{
Serial.println(GarbageCaps3no);
analogWrite(RedNo, 250);
analogWrite(RedNo, 0);
}
if (targetDUS2 >= 11 && targetDUS2 <= 20)
{
Serial.println(GarbageCaps2no);
analogWrite(YellowNo, 250);
analogWrite(YellowNo, 0);
}
if (targetDUS2 >20)
{
Serial.print(GarbageCaps1no);
analogWrite(GreenNo, 250);
analogWrite(GreenNo, 0);
}
}
void loop()
{
Blynk.run();
timer.run();
}
Research a lots of coding and the way it works on the community such as
but still got the same results with no output on the blynk. if i erase all the delay for the LED, then how should i make the LED blinking. and I use 2 Gauge on the Blnyk Apps for Metal (V10) and Non Metal (V12) both is PUSH. My connection is USB type
#define BLYNK_PRINT Serial1
#include <BlynkSimpleStream.h>
BlynkTimer timer;
char auth[] = "cabb6d95d9804956b25f9e4553fc10b8";
int GreenMe =4 ;
int YellowMe =3 ;
int RedMe =2 ;
int EchoMe =38 ;
int TrigMe =39 ;
float pingUS1 ;
float targetDUS1;
String GarbageCaps1me="The Garbage Capacity for Metal is 0%";
String GarbageCaps2me="The Garbage Capacity for Metal is 50%";
String GarbageCaps3me="The Garbage Capacity is for Metal 100%";
int GreenNo =10;
int YellowNo =9;
int RedNo =8;
int EchoNo =44;
int TrigNo =45;
float pingUS2;
float targetDUS2;
String GarbageCaps1no="The Garbage Capacity for Non-Metal is 0%";
String GarbageCaps2no="The Garbage Capacity is Non-Metal 50%";
String GarbageCaps3no="The Garbage Capacity is Non-Metal 100%";
float speedOfSound=776.5;
String GarbageLCD="Garbage Capacity";
void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
Blynk.begin(Serial, auth);
pinMode(EchoMe, INPUT);
pinMode(TrigMe, OUTPUT);
pinMode(EchoNo, INPUT);
pinMode(TrigNo, OUTPUT);
timer.setInterval(1000L, USMe);
timer.setInterval(1000L, USNo);
}
void USMe()
{
digitalWrite(TrigMe, LOW);
delayMicroseconds(100);
digitalWrite(TrigMe, HIGH);
delayMicroseconds(20);
digitalWrite(TrigMe, LOW);
pingUS1 = pulseIn(EchoMe, HIGH);
pingUS1 = pingUS1/1000000;
pingUS1 = pingUS1/3600;
targetDUS1 = speedOfSound*pingUS1;
targetDUS1 = targetDUS1/2;
targetDUS1 = targetDUS1*63360;
targetDUS1 = targetDUS1*2.54;
Serial.print("The distance to the trash is: ");
Serial.print(targetDUS1);
Serial.println(" centimeters");
Blynk.virtualWrite(V10, targetDUS1);
if (targetDUS1 < 10)
{
Serial.println(GarbageCaps3me);
analogWrite(RedMe, 250);
analogWrite(RedMe, 0);
}
if (targetDUS1 >= 11 && targetDUS1 <= 20)
{
Serial.println(GarbageCaps2me);
analogWrite(YellowMe, 250);
analogWrite(YellowMe, 0);
}
if (targetDUS1 >20)
{
Serial.print(GarbageCaps1me);
analogWrite(GreenMe, 250);
analogWrite(GreenMe, 0);
}
}
void USNo()
{
digitalWrite(TrigNo, LOW);
delayMicroseconds(100);
digitalWrite(TrigNo, HIGH);
delayMicroseconds(20);
digitalWrite(TrigNo, LOW);
pingUS2 = pulseIn(EchoNo, HIGH);
pingUS2 = pingUS2/1000000;
pingUS2 = pingUS2/3600;
targetDUS2 = speedOfSound*pingUS2;
targetDUS2 = targetDUS2/2;
targetDUS2 = targetDUS2*63360;
targetDUS2 = targetDUS2*2.54;
Serial.print("The distance to the trash is: ");
Serial.print(targetDUS2);
Serial.println(" centimeters");
Blynk.virtualWrite(V12, targetDUS2);
if (targetDUS2 < 10)
{
Serial.println(GarbageCaps3no);
analogWrite(RedNo, 250);
analogWrite(RedNo, 0);
}
if (targetDUS2 >= 11 && targetDUS2 <= 20)
{
Serial.println(GarbageCaps2no);
analogWrite(YellowNo, 250);
analogWrite(YellowNo, 0);
}
if (targetDUS2 >20)
{
Serial.print(GarbageCaps1no);
analogWrite(GreenNo, 250);
analogWrite(GreenNo, 0);
}
}
void loop()
{
Blynk.run();
timer.run();
}
the millis function seems complicated to understand and to apply on my coding based on youtube on how to do the coding and is it the same as delayMicroseconds(x)?
as @Gunner always says ,
you have to learn blynk before coding anything.
try basic blynk sketches to understand blynk timers,
there is a lot of examples on this community.