Bluetooth connectivity

Bluetooth connectivity is one of the promises of the watchX. Even hardware is installed, I couldn’t find any software solution yet. I want to communicate between my watchX and my iPhone. There are a lot of good tutorials, for example:
https://learn.adafruit.com/crack-the-code/overview
Even obviously you can connect watchX and iPhone, there is no way to communicate between them. For my understanding all these tutorials are using specific BLE shields (Adafruit, Red Bear …) which’s pin settings differ from watchX. I am not a computer scientist and therefore finding the right pin setting is a blind flight.
So my question is: Does anybody has a solution for that?
Thanks in advance

Hello Michl,

Please download and install one of the apps based on your phone:

Please download the examples from http://watchx.io/download.php. You will see an example called BLE. Open it and install the firmware to your watchX. Open the serial terminal and proceed to phone side. Open the app on your phone and connect to your watchX. Then tap: UART. Now you can communicate with your watchX and forth.

Let us know your progress.

2 Likes

Hi Mustafa,

thanks a lot for fast help. The BLE example is working well even with the Adafruit app, which I found here: https://learn.adafruit.com/crack-the-code/overview .
It’s called “Basic Chat” and it is a xcode/swift example. Now I try to adapt it for my purposes.

Best regards Michael

3 Likes

… just running into a problem: I tried to integrate bluetooth feature into another sketch in which I use interrupts for wakeup from sleeping. But as soon both libraries Adafruit_BLE.h and EnableInterrupt.h are included in the same sketch verifying leads to an error:

libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin): In function SoftwareSerial::read()': (.text+0x0): multiple definition of__vector_9’
sketch\sketch_nov30a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Leonardo.

Any ideas?

2 Likes

I run into this problem as well. I think both Adafruit_BLE.h and EnableInterrupt.h uses the same vector to fire an interrupt. Did you try finding another library for the interrupts?

My sleeping feature is based on this example: https://www.reddit.com/r/watchX/comments/8vjciw/watch_code_with_sleep_and_interruptbased_waking/
As you proposed I made some trials with other libraries such as avr interrupt.h . But no success. Isn’t it possible to attach interupts without a library?

I will try to find a solution, if I can’t I may edit the BLE library or the Interrupt library;)

As far as I know i don‘t use an interrupt library within TapClock for the MPU Interrupt.
Just attach and detach commands.
Found here: https://www.arduino.cc/reference/en/language/functions/external-interrupts/attachinterrupt/

Still fighting with the old problem. As mtulu proposed I tried another library for the interrupts. It is the same venice1200 used in the WordClock Mode of his TapClock example (PinChangeInterrupt from https://github.com/NicoHood/PinChangeInterrupt). This allows wakeup by a button. In my example sketch it works fine. See: https://github.com/micha01/watchX-ButtonInterrupt-BLE

But as soon as the Adafruit_BLE.h will be included the same error appears as I had with the EnableInterrupt.h library (see above).

Is there a way to use Adafruit_BLE and Button wakeup in the same sketch?

As far as I know you need to use PinChangeInterrupt for the Buttons and the “normal” Interrupt statements for the BLE/MPU and RTC.
But I can’t get the BLE to work only MPU and RTC.

When googeling it appears that this is a conflict with the SoftwareSerial.h. SoftwareSerial seems to occupy all PinChange interrupts. There are some general proposals to use other libraries instead (AltSoftSerial, NeoSWSerial etc.), but I am not experienced enough to adopt this. In other words to make the changes in the affected libraries (for example SoftwareSerial.h, Adafruit_Ble.h, PinChangeInterrupt.h). Any help?

PROBLEM SOLVED: There is a solution to avoid the conflict between the bluetooth library Adafruit_BLE.h and libraries for pin changes such as PinChangeInterrupt.h or EnableInterrupt.h. As mentioned above the underlaying SoftwareSerial.h is the troubleshooter.
Just comment out the line “ #define SOFTWARE_SERIAL_AVAILABLE … “ in Adafruit_BluefruitLE_UART.h library:
library

That’s it. Now it is possible to use bluetooth and a wake up (interrupt) button in the same sketch and watchX application.

3 Likes

Great finding…

Wow! An amazing solution! Thank you!

Could you add it to the Coding tips & tricks section please :sunglasses:

I made an example in education section.

1 Like

Managed to use watchX BLE capabilities to control a Zumo rover.

2 Likes

Video video video :star_struck::star_struck::star_struck:

1 Like

Thanks Mustafa, shared a video here

2 Likes

Wow, let me try! :star_struck: