Hi guys. I am a Blynk newbee with an Arduino Uno and a GPRS/GSM SIM900 Shield.
I’ve created my GUI on the Blynk app for iOS, in which I am able to send data from the Arduino IDE to the app’s widget LEDs. However, I want to blink an LED to the hardware but no data seems to be transmitted the other way around (all virtual, digital and analog data).
Anyone who can help with this?
Here is my code:
/*************************************************************
*************************************************************/
#define BLYNK_PRINT Serial
#define TINY_GSM_MODEM_SIM900
// Default heartbeat interval for GSM is 60
// If you want override this value, uncomment and set this option:
//#define BLYNK_HEARTBEAT 30
#include <TinyGsmClient.h>
#include <BlynkSimpleSIM800.h>
int LEDPin;
int PinValue = 11;
WidgetLED led1(V0);
WidgetLED led2(V1);
WidgetLED led3(V2);
WidgetLED led4(V3);
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "******************************";
// Your GPRS credentials
// Leave empty, if missing user or pass
char apn[] = "internet";
char user[] = "";
char pass[] = "";
// Hardware Serial on Mega, Leonardo, Micro
//#define SerialAT Serial1
// or Software Serial on Uno, Nano
#include <SoftwareSerial.h>
SoftwareSerial SerialAT(7, 8); // RX, TX
TinyGsm modem(SerialAT);
void setup()
{
// Debug console
Serial.begin(9600);
// Set GSM module baud rate
SerialAT.begin(9600);
delay(3000);
// Restart takes quite some time
// To skip it, call init() instead of restart()
modem.restart();
// Unlock your SIM card with a PIN
//modem.simUnlock("1234");
Blynk.begin(auth, modem, apn, user, pass);
pinMode(PinValue, OUTPUT);
}
//BLYNK_CONNECTED()
//{
//Blynk.syncVirtual(V5);
//}
BLYNK_WRITE(V5)
{
LEDPin = param.asInt();
Serial.print("LED status: ");
Serial.println(param.asInt());
if(LEDPin == 1)
{
Serial.print("Printing: ");
Serial.println(LEDPin);
digitalWrite(PinValue, HIGH);
}
}
void loop()
{
Blynk.run();
}
Other infomration:
- The Blynk library version you are using.
V0.4.4. - Android or iOS and the version of the OS.
iOS 9.3.1 - Server type, Local or Cloud based.
Cloud based - If local server, which version you are using.
- How you powering the MCU.
USB Port from PC - Has the MCU ever connected to a Blynk server (Cloud or local).
Yes, the connection actually becomes established. - The IDE you are using, including the version number.
Arduino IDE version 1.8.1 - The settings you have in the IDE for the MCU.
Only the board setting: Arduino Uno
9.The Arduino core version you are using.
Arduino Uno - The make and model of your phone.
iPhone 5s
11.Your shoe size and anything else you think is important.
I hope this becomes relevant