Everything went smoothly thanks to the examples provided. They were clear to understand so the implementation of Blynk on the MSP432 + CC2650 was easy.
The core code is listed below. ble provides the serial port to Blynk.
///
/// @mainpage IoT_BLE
///
/// @details IoT BLE with Blynk on MSP432 + CC2650
/// @n
/// @n
/// @n @a Developed with [embedXcode+](http://embedXcode.weebly.com)
///
/// @author Rei Vilo
/// @author http://embeddedcomputing.weebly.com
/// @date May 25, 2018
/// @version 1.0.1
///
/// @copyright (c) Rei Vilo, 2018
/// @copyright CC = BY SA NC
///
// Core library for code-sense - IDE-based
// !!! Help: http://bit.ly/2AdU7cu
#include "Energia.h"
// Set parameters
#define BLYNK_PRINT Serial
// Include application, user and local libraries
#include "BLE.h"
#include <BlynkSimpleSerialBLE.h>
// Define structures and classes
// Define variables and constants
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
// Prototypes
// !!! Help: http://bit.ly/2l0ZhTa
// Utilities
// Functions
// Add Setup code
void setup()
{
// Debug console
Serial.begin(9600);
ble.begin();
ble.serial();
ble.setAdvertName("BlynkCC2650");
ble.startAdvert();
// Blynk will work through Serial1
// Do not read or write this serial manually in your sketch
Blynk.begin(ble, auth);
pinMode(RED_LED, OUTPUT);
digitalWrite(RED_LED, LOW);
}
void loop()
{
Blynk.run();
}
// This function tells Arduino what to do if there is a Widget
// which is requesting data for Virtual Pin (0)
BLYNK_READ(0)
{
float t = random(220, 330) / 10.0;
Blynk.virtualWrite(0, t);
BLYNK_LOG("Random T= %8.1f °C", t);
}
// This function will be called every time
// when App writes value to Virtual Pin 5
BLYNK_WRITE(2)
{
BLYNK_LOG("LED %s", param.asStr());
if (param.asInt() > 0)
{
digitalWrite(RED_LED, HIGH);
}
else
{
digitalWrite(RED_LED, LOW);
}
}
At this time, it works against the LaunchPad w/ msp432 EMT (48MHz), not the RED LaunchPad w/ msp432 EMT (48MHz). See Porting BLE Library to MSP432 Red