I am new to Arduino and blynk. I was working on the automated cloth line with blynk as my mobile application and I got it partially working. I am using virtual pin to enter the loop which is working perfectly fine. But upon the same button press it is supposed to end the loop which is not happening in the current state.
Seems that i am missing something simple. Any thoughts ?
#define BLYNK_PRINT DebugSerial
int in3 = 7;
int in4 = 8;
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#include <BlynkSimpleStream.h>
char auth[] = "6787948d586b458a96a1bcf38a952297";
void setup()
{
Serial.begin(9600);
Blynk.begin(Serial, auth);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
}
BLYNK_WRITE(V3) //AUTOMATIC
{
int pinValue2 = param.asInt(); // assigning incoming value from pin V1 to a variable
{
do {
if (analogRead(0) < 650)
{
digitalWrite(8, HIGH);
digitalWrite(7, LOW);
}
else
{
digitalWrite(8, LOW);
digitalWrite(7, HIGH);
}
}
while (pinValue2 != 0);
}
}
void loop()
{
Blynk.run();
}