Quickstart Problem

I am currently working in the following quickstart:

I have performed all of the steps, including pasting the new platform.ini:
[env:bw_swan_r5]

platform = ststm32

board = bw_swan_r5

upload_protocol = dfu

framework = arduino

build_flags = -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC

monitor_speed = 115200

lib_deps =

Wire

blues/Blues Wireless Notecard@^1.4.1


My main.cpp code is:
#include <Arduino.h>

#include <Notecard.h>

#define usbSerial Serial

#define productUID “com…:…”

Notecard notecard;

// the setup function runs once when you press reset or power the board

void setup()

{

delay(2500);

usbSerial.begin(115200);

notecard.begin();

notecard.setDebugOutputStream(usbSerial);

J *req = notecard.newRequest(“hub.set”);
JAddStringToObject(req, “product”, productUID);
JAddStringToObject(req, “mode”, “continuous”);
notecard.sendRequest(req);

}

// the loop function runs over and over again forever

void loop()

{

}


At 10:22 in the video my serial monitor looks nominally like his:

— Terminal on COM33 | 115200 8-N-1
— Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
— More details at Redirecting...
— Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H

However, after I pushed the “RST” button nothing changes on my serial monitor, specifically the req hubset indication does not show up on mine.

And the “Devices/Last seen” page on notehub.io is not updating.

Any ideas?
Thanks,
Ray R


Update: I put the following into Loop():

J *req = notecard.newRequest(“hub.set”);
JAddStringToObject(req, “product”, productUID);
JAddStringToObject(req, “mode”, “continuous”);
notecard.sendRequest(req);

It ran as expected and output the following as expected on the serial monitor:

{“req”:“hub.set”,“product”:“com.xxxxx.yyyyyy:zzzzzz”,“mode”:“continuous”,“body”:{“agent”:“note-arduino”,“compiler”:“gcc 10.3.1 20210824
(release)”,“req_interface”:“i2c”,“cpu_name”:“swan_r5”},“crc”:“00C0:C79ACDC6”}

And Notehub/Devices Last seen also updated.

However, I still can’t figure out why the “Setup” version of the hub.set command doesn’t get to notehub.

Hi @Raymond,

You definitely don’t want to keep the hub.set call in your loop() method, but it may just be the case that the setup() method executes before the serial monitor is able to register the request. Just a thought. Usually after resetting the host, you still need to reconnect the serial monitor.

I’ve had the best experience with the VS Code Serial Monitor extension FYI.

Rob

Thank you Rob for your quick reply. Yes, I realized that and just waited long enough to get several serial monitor samples before pulling the plug.

And I’ll check out the VS Code Serial Monitor extension.

Thanks again…

1 Like