Hi guys. I get a ‘pinValue’ was not declaed in this scope’ error when trying to compile the below code. I am new to this, and might have done lots of things wrong, so please bear with me. I am using a Wemos D1 board (ESP8266 Wifi) and using the Blynk server. Library version is v0.5.4
Thank you very much
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int pos= 0; // variable to store the servo position
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "c69a278c02814112bf20f7f4f9318ac9";
BlynkTimer timer; // Create a Timer object called "timer"!
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Legere";
char pass[] = "5596226781";
// in Blynk app write values to the Virtual Pin V1
BLYNK_WRITE(V1)
{
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
}
void setup()
{
// Debug console
Serial.begin(9600);
pinMode(4, OUTPUT);
myservo.attach(5); // attaches the servo on pin 5 to the servo object
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
if (pinValue == "1") {
digitalWrite(4,HIGH); //switches external led on
for(pos = 0; pos < 180; pos += 4) // goes from 0 degrees to 180 degrees
// in steps of 4 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
}
else {
digitalWrite(4, LOW); //switches external led off
for(pos = 180; pos>=1; pos-=4) // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
}
void loop()
{
Blynk.run();
timer.run();
}