I have a Bluefruit LE uart friend and Arduino Uno, and thought the app I can connect the module to my iPhone, however as soon as I start the program the module disconnects. Why is this happening?
Blynk app version?
Blynk library version?
Sketch?
Serial monitor output?
Connection diagram?
Pete.
Blynk app version:2.26.8 (1)
Blynk library version: 1.0.1
Connection: vin - 5v, gnd - gnd, tx - rx, rx - tx
The serial monitor just says ‘waiting for connections’.
sketch:
#define BLYNK_USE_DIRECT_CONNECT
// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(0, 1); // RX, TX
#define BLYNK_PRINT DebugSerial
/* Fill-in your Template ID (only if using Blynk.Cloud) */
//#define BLYNK_TEMPLATE_ID "YourTemplateID"
#include <BlynkSimpleSerialBLE.h>
char auth[] = "B_AlPndu8snMP7-KyIIeOpS-k450_0Oq";
void setup()
{
DebugSerial.begin(9600); // Debug console
DebugSerial.println("Waiting for connections...");
Serial.begin(9600);
Blynk.begin(Serial, auth);
}
void loop()
{
Blynk.run();
}
You are using blynk legacy, you should use blynk library version 0.6.1 instead of 1.0.1
What do you see when you open the BLE widget in the Blynk app? Are your seeing the device and making the connection there?
Pete.
@John93 I have installed blynk library 0.6.1 and installed 1.0.1 however the Bluetooth module still doesn’t connect. I have connected to it with another app so I know it works. Is there anything else?
Try pins (2, 3) instead of (0, 1)
@PeteKnight In the BLE widget I see the module and making the connection there, however it says can’t connect.
Have you tried this :
/*************************************************************
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials: http://www.blynk.cc
Sketch generator: http://examples.blynk.cc
Blynk community: http://community.blynk.cc
Social networks: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
This example shows how to use Adafruit Bluefruit LE nRF8001 breakout
to connect your project to Blynk.
Note: This requires BLEPeripheral library
from http://librarymanager/all#BLEPeripheral
or https://github.com/sandeepmistry/arduino-BLEPeripheral
NOTE: BLE support is in beta!
*************************************************************/
#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial
/* Fill-in your Template ID (only if using Blynk.Cloud) */
//#define BLYNK_TEMPLATE_ID "YourTemplateID"
#include <BlynkSimpleBLEPeripheral.h>
#include <BLEPeripheral.h>
#include <SPI.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// Define pins (varies per shield/board)
#define BLE_REQ 10
#define BLE_RDY 2
#define BLE_RST 9
// Create ble serial instance, see pinouts above
BLESerial SerialBLE(BLE_REQ, BLE_RDY, BLE_RST);
void setup() {
Serial.begin(9600);
SerialBLE.setLocalName("Blynk");
SerialBLE.setDeviceName("Blynk");
SerialBLE.setAppearance(0x0080);
SerialBLE.begin();
Serial.println("Waiting for connections...");
Blynk.begin(SerialBLE, auth);
}
void loop() {
SerialBLE.poll();
if (SerialBLE) { // If BLE is connected...
Blynk.run();
}
}
Can you post screenshots of that, along with what your serial monitor shows at the same point in time.
Pete.
This won’t work because I have the uart friend ble module, which connects through serial tx rx, and the sketch that you have suggested uses spi connection which uses REQ, RDY, RST. Thank you for the suggestion though.
Okay, can you show me your wiring diagram please ?
I guess you should read this :