Sponsored Content
Top Forums Programming Basic Arduino UNO Bluetooth Testing with the BLE 4.0 (CC2541, MLT-BT04 IC) Post 303043373 by Neo on Sunday 26th of January 2020 10:57:32 PM
Old 01-26-2020
Update and Issues:

Having some problems with the ArdunioBlue IOS app because I cannot find any method / sketch to send data from the Arduino BLE module to IOS. However, sending data to the Arduino BLE module from IOS works fine. Unless I am missing something huge, the ArduinoBlue IOS app is "one way communications" only, as far as the user is concerned. I sent an email to the developer, but it bounced as "undeliverable". I would prefer to have BLE comms bidirectional, obviously.

Edit(Update): I found more docs on ArdunioBlue and then found a method (which I have tested and it works) to send messages from the Arduino back to IOS:

Code:
void sendMessage(String text) - Sends the text to the phone as a popup

So, I then tried the Blynk IOS app again, running the basic Terminal sketch:


Code:
/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  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
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  Warning: Bluetooth support is in beta!

  You can send/receive any data using WidgetTerminal object.

  App project setup:
    Terminal widget attached to Virtual Pin V1
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX
    
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

SoftwareSerial SerialBLE(10, 11); // RX, TX

// Attach virtual serial terminal to Virtual Pin V1
WidgetTerminal terminal(V1);

// You can send commands from Terminal to your hardware. Just use
// the same Virtual Pin as your Terminal Widget
BLYNK_WRITE(V1)
{

  // if you type "Marco" into Terminal Widget - it will respond: "Polo:"
  if (String("Marco") == param.asStr()) {
    terminal.println("You said: 'Marco'") ;
    terminal.println("I said: 'Polo'") ;
  } else {

    // Send it back
    terminal.print("You said:");
    terminal.write(param.getBuffer(), param.getLength());
    terminal.println();
  }

  // Ensure everything is sent
  terminal.flush();
}

void setup()
{
  // Debug console
  Serial.begin(9600);

  SerialBLE.begin(9600);
  Blynk.begin(SerialBLE, auth);

  Serial.println("Waiting for connections...");

  // This will print Blynk Software version to the Terminal Widget when
  // your hardware gets connected to Blynk Server
  terminal.println(F("Blynk v" BLYNK_VERSION ": Device started"));
  terminal.println(F("-------------"));
  terminal.println(F("Type 'Marco' and get a reply, or type"));
  terminal.println(F("anything else and get it printed back."));
  terminal.flush();
}

void loop()
{
  Blynk.run();
}

But after many tries, I cannot get the Blynk IOS app to connect to the Arduino BLE module, even thought it works fine with other IOS BLE apps, so I posted a question on this in the Blynk Community:

What's Up With Blynk? Cannot Connect With Basic Example Ardunio UNO / HM-10 Sketch?

Code:
https://community.blynk.cc/t/whats-up-with-blynk-cannot-connect-with-basic-example-ardunio-uno-hm-10-sketch/43204

Let's see if I can resolve this issue before my attention span moves on to another test setup Smilie

Code:
10:55:06.367 -> [0] 
10:55:06.367 ->     ___  __          __
10:55:06.367 ->    / _ )/ /_ _____  / /__
10:55:06.367 ->   / _  / / // / _ \/  '_/
10:55:06.367 ->  /____/_/\_, /_//_/_/\_\
10:55:06.367 ->         /___/ v0.6.1 on Arduino Uno
10:55:06.367 -> 
10:55:06.367 -> [89] Connecting...
10:55:08.003 -> [0] 
10:55:08.003 ->     ___  __          __
10:55:08.003 ->    / _ )/ /_ _____  / /__
10:55:08.039 ->   / _  / / // / _ \/  '_/
10:55:08.072 ->  /____/_/\_, /_//_/_/\_\
10:55:08.107 ->         /___/ v0.6.1 on Arduino Uno
10:55:08.144 -> 
10:55:08.144 -> [89] Connecting...
10:55:11.258 -> [3229] Login timeout
10:55:13.266 -> [5229] Connecting...
10:55:16.369 -> [8349] Login timeout
10:55:18.359 -> [10349] Connecting...
10:55:21.494 -> [13469] Login timeout
10:55:23.512 -> [15469] Connecting...
10:55:28.623 -> [20589] Connecting...

This User Gave Thanks to Neo For This Post:
 

7 More Discussions You Might Find Interesting

1. OS X (Apple)

Semi-Automatic Arduino Detection.

I am working on a semi-auto detection idea for Arduino for the Scope project. It does require a little user intervention but minimal. It works by just responding to two on screen prompts to unplug and plug Arduino into a USB port. There are two versions and both work perfectly well and give... (3 Replies)
Discussion started by: wisecracker
3 Replies

2. Programming

Very Basic Arduino Uno Board Testing

A very simple Arduino board test... LOL Here is some very easy code to test a cheap Arduino board I just got from China via Aliexpress. I am still waiting on a about 30 more orders from Aliexpress for more Arduino stuff. This was the first order which made it here. /* Arduino test-code... (18 Replies)
Discussion started by: Neo
18 Replies

3. Programming

Arduino-cli - Uploading to Unknown Chinese Arduino Boards using the Arduino Command Line Interface

In my further exploration of Arduino, today I decided to install the arduino-cli on my mac today. https://github.com/arduino/arduino-cli I followed the instructions for macOS but when I got to this part: arduino-cli board list I got the dreaded "Unknown" Fully Qualified Board Name... (1 Reply)
Discussion started by: Neo
1 Replies

4. Programming

More Arduino Stuff...

HI all... (Apologies for any typos.) To add to Neo's Arduino subject matter I have decided to upload this in ".zip" format. Ignore "*.info" files these are AMIGA icons only and also the "HAM" drawer as these are photos in ancient AMIGA HAM modes. I have noticed that there are current... (6 Replies)
Discussion started by: wisecracker
6 Replies

5. Programming

Chinese Arduino UNO Clones - The Wavgat versus the generic UNO R3 Clone - The Winner Is?

Waiting for more fun Ardunio parts from AliExpress, I decided to test two cheap Chinese Arduino UNO clones. The Arduino UNO R3 (CH340G) MEGA328P The Wavgat UNO R3 (CH340G) MEGA328P Both of these Chinese Ardunio clones sell for about $3 USD, delivered to your door. The bottom line is... (0 Replies)
Discussion started by: Neo
0 Replies

6. Programming

Arduino UNIX Time - Syncing Computer UNIX Time to Arduino Time with Python

Just finished a quick Python script to send the current unix time over to the Arduino from macOS, so in the absence of GPS or some other way to get the unix timestamp (epoch time) to the Arduino, I can get my macOS and Arduino UNO synced to within a second. Normally, when the Arduino starts... (9 Replies)
Discussion started by: Neo
9 Replies

7. Programming

Arduino Project: iPhone to HM-10 BLE to NB-IoT Shield to NB-IoT Network to Internet to Linux Server

This post describes a "work in progress" project I started today. Here is the High Level Overview: Currently, this project sits on my desk as an Arduino UNO (on the bottom), an NB-IoT Shield (sandwiched in the middle), a Sensor Shield (on top) with a HM-10 BLE Module (in the little... (13 Replies)
Discussion started by: Neo
13 Replies
All times are GMT -4. The time now is 10:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy