I wanted to get an Argon to work with the iPhone Blynk App using BLE. It turned out to be really simple using a HM-10 board, but I’d really like to use the built-in BLE. Has anyone gotten this to work?
For the HM-10 it was only a few lines of code:
#define BLYNK_PRINT Serial // Set serial output for debug prints
#include <BlynkSimpleSerialBLE.h>
char auth[] = "your auth token";
void setup() {
Serial.begin(9600);
Serial.println("Waiting for connections");
Serial1.begin(9600);
Blynk.begin(Serial1, auth);
}
void loop() {
Blynk.run();
}
Then on your iPhone APP you add the BLE icon and a BUTTON icon. Set the BUTTON icon to be a switch and DIGITAL PIN D7. Before running the App, click on the BLE icon. Hit the CONNECT and select your HM-10 device. It should say something like “DSD TECH connected”. Then hit OK, and the PLAY button. The Blynk app will say the Argon is OFFLINE, but the app will be working. Clicking on the Button will turn on/off the BLUE USB LED
It’s not as straight forward when directly interacting with BLE.
With the HM-10 your code is not directly talking via BLE but only uses a Stream object to communicate - in your case the Serial1 object (which is derived from Stream).
In order to reuse that Blynk sample you’d need to wrap a BLE UART service into a class which inherits from Stream then you can pass that object to Blynk.begin(yourStreamObject, auth).
Unfortunately I don’t know of any and I doubt that there actually is one as I’d consider this to be more of a chimera use-case where a direct approach would be more suitable.
It would be like hosing water from the tap into a bottle just to then immediately pour it from the bottle into the glass - rationally you’d just take the glass to the tap and fill it there
Your response makes no sense to me? Blynk is a very fast/easy way to make iPhone apps to talk with Particle devices. When home, I can easily use my WIFI to connect/control particle devices.
My current project is building an Solar eBike Trailer. The solar panel charges my eBike battery when I’m on extended trips (The trailer also carries my luggage). The Photo/Argon uses 9DOF (compass/panel tilt), GPS (time,LAT/LON), and current sensors (Solar output) to optimally orient the panel towards the sun. I use Blynk with Bluetooth to monitor what is going on and for simple commands like “store panel for high winds”.
I thought I could use the ARGON BLE for this. Turns out so far I can only get it to work with the HM-10. Which begs the question why not just use the Photon instead of the more expensive ARGON.
I suppose I could bring a cell phone WIFI hotspot, but a lot of areas I’ll be biking do not have Cell coverage. Not sure what other iPhone/wireless options besides BLE I could use. It may be a square peg… but it does work (with HM-10).
@nafis, the issue is not with Particle but with the fact that Blynk has no support for the Particle Gen3 BLE functionality. It is up to Blynk to add the necessary library files to create a BLE UART peripheral with the Gen3 device, not up to Particle. Perhaps if you ask in the Blynk forum, it may get some attention. You could even log an issue on their github repo.