Hello team im trying to run a motor remotly by connecting an output to the pin 2 everything is working fine but i want a feedback input to let me know that the motor is running i tried to use the pin number 6 with Blynk.virtualWrite function but still cant get any feedback when i simulate the input from 5v of the board and pin number 6
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
/* Fill-in your Template ID (only if using Blynk.Cloud) */
#define BLYNK_TEMPLATE_ID "TMPL6vYPBfgt_"
#define BLYNK_TEMPLATE_NAME "mkr 1400"
#define BLYNK_AUTH_TOKEN "9fhnYlv8hBiintHGuBVrbJKKPc7cqCut"
#include <SPI.h>
#include <MKRGSM.h>
#include <BlynkSimpleMKRGSM.h>
GSMClient client;
GPRS gprs;
GSM gsmAccess;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "9fhnYlv8hBiintHGuBVrbJKKPc7cqCut";
// Your SIM and GPRS credentials
// Leave empty, if missing pin, user or pass
char pin[] = "";
char apn[] = "web.vodafone.com.qa";
char user[] = "";
char pass[] = "";
const int BUTTON_VPIN = 6;
int buttonState = digitalRead(BUTTON_VPIN);
BLYNK_WRITE(V1) // Executes when the value of virtual pin 0 changes
{
if(param.asInt() == 1)
{
// execute this code if the switch widget is now ON
digitalWrite(2,HIGH); // Set digital pin 2 HIGH
}
else
{
// execute this code if the switch widget is now OFF
digitalWrite(2,LOW); // Set digital pin 2 LOW
}
delay(10);
}
void setup()
{
pinMode(2, OUTPUT); // Initialise digital pin 2 as an output pin
Serial.begin(9600);
Blynk.begin(auth, gsmAccess, gprs, client, pin, apn, user, pass);
}
void loop()
{
Blynk.run();
Blynk.virtualWrite(V6, buttonState);
}