Win10, VSC, Platform IO, and Serial monitor extensions installed. I do not see any activity in the Serial Monitor (platformio:serial monitor or VSC Serial Monitor). However I CAN see the data being published to notehub.
I can flash the Swan using Stlink or DFU no problem.
Using Zadig installed USB drivers, The Window USB drivers seem to be fine and recognized. I have uninstalled/reinstalled platform IO. Tried using different baud rates. Tried using Arduino IDE still no reporting on the Serial Monitor. What am I missing?..It must be something simple.
Setup is USB to swan on the carrier-F with notecard and USB serial connection STLink.
void setup()
{
// put your setup code here, to run once:
delay(2500);
usbSerial.begin(115200);
usbSerial.println(“Starting up…”);
notecard.begin();
notecard.setDebugOutputStream(usbSerial);
J *req = notecard.newRequest(“hub.set”);
JAddStringToObject(req, “product”, productUID);
JAddStringToObject(req, “mode”, “continuous”); // set to periodic if running on battery
JAddBoolToObject(req, “sync”, true); // sync to notehub.io sync env variable immediately if it changes. set to false if running on battery
notecard.sendRequest(req);
}
void loop()
{
// put your main code here, to run repeatedly:
float temperature = sensor.temp();
float humidity = sensor.humidity();
usbSerial.print(“Temperature = “);
usbSerial.print(temperature);
usbSerial.println(” *C”);
usbSerial.print(“Humidity = “);
usbSerial.print(humidity);
usbSerial.println(” %”);
J *req = notecard.newRequest(“note.add”);
if (req != NULL)
{
JAddStringToObject(req, “file”, “sensors.qo”);
JAddBoolToObject(req, “sync”, true); // delete if running on battery or se to false
J *body = JAddObjectToObject(req, “body”);
if (body)
{
JAddNumberToObject(body, “temp”, temperature);
JAddNumberToObject(body, “humidity”, humidity);
}
notecard.sendRequest(req);
}
// delay(15000); replaced with getSensorInterval() instead of hardcoding 15 seconds
int sensorIntervalSeconds = getSensorInterval(); // getSensorInterval() returns an integer
usbSerial.print(“Delaying “);
usbSerial.print(sensorIntervalSeconds);
usbSerial.println(” seconds”);
delay(sensorIntervalSeconds * 1000); // delay for sensorIntervalSeconds * 1000
}
// This function assumes you’ll set the reading_interval environment variable to
// a positive integer. If the variable is not set, set to 0, or set to an invalid
// type, this function returns a default value of 60.
int getSensorInterval()
{
int sensorIntervalSeconds = 60;
J *req = notecard.newRequest(“env.get”); // environment variable get
if (req != NULL)
{
JAddStringToObject(req, “name”, “reading_interval”); // reading_interval is the name of the environment variable I creaated in notehub.io for 30 seconds. key value pair
// can push out changes over cell. dont need to update code on every device.
J *rsp = notecard.requestAndResponse(req); // request and response
int readingIntervalEnvVar = atoi(JGetString(rsp, “text”)); // converts string to integer
if (readingIntervalEnvVar > 0) // if readingIntervalEnvVar is greater than 0
{
sensorIntervalSeconds = readingIntervalEnvVar; // set sensorIntervalSeconds to readingIntervalEnvVar
}
notecard.deleteResponse(rsp); // delete response
}
return sensorIntervalSeconds; // return sensorIntervalSeconds
}