Hi Blynkers,
I need some help with my project. I’ve been trying to run the following program on my Arduino Uno with a HM-10 bluetooth module. The problem is that: “Serial.println(Slider)” stays zero in serial monitor when i move the slider on the app side. The programs runs perfect when i use ethernet connection instead of bluetooth. Can anybody tell me please how to solve this without placing the “Serial.println(Slider)” outside the void loop function? Thank you!
#define BLYNK_PRINT Serial
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(12, 13); // RX, TX
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
int Slider;
char auth[] = "secret";
SoftwareSerial SerialBLE(12, 13); // RX, TX
// This function will be called every time Slider Widget
// in Blynk app writes values to the Virtual Pin 1
BLYNK_WRITE(V1)
{
int Slider = param.asInt(); // assigning incoming value from pin V1 to a variable
}
void setup()
{
// Debug console
Serial.begin(9600);
SerialBLE.begin(9600);
Blynk.begin(SerialBLE, auth);
Serial.println("Waiting for connections...");
}
void loop()
{
Serial.println(Slider);
Blynk.run();
}