Hi guys. I am currently working on a project that will require an OTA code upload to get it to work. However, at the moment I'm focusing on getting the IoT Cloud to work.
Using the IDE, I am receiving a signal from pin A0 and then interpolating the data using some previous data I acquired. The data I receive can then be plotted easily as it's a float.
For the Cloud I have created a read only float variable called 'load', with a variable update policy of on change and a threshold of 0. The Nano 33 IoT is my chosen device and is configured. The network is set to my mobile hotspot details.
Here is the code I am uploading:
/*
Sketch generated by the Arduino IoT Cloud Thing "33IoT Hand"
https://create.arduino.cc/cloud/things/92d3ab77-d748-4c72-9b14-e58bcd9bfa33
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
float load;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
float aR = 353;
float aL = 0;
float bR = 1023;
float bL = 50;
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(4);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
// Your code here
float curReading = 1023 - analogRead(0); // Take reading of analog pin 0 of Arduino
float load = ((bL - aL)/(bR - aR)) * (curReading - aR) + aL;
Serial.println(load);
delay(1000);
}
I then link the variable to a gauge on the dashboard. However, when I upload the code, the gauge does not display my readings.
Any help greatly appreciated!
EDIT: Attempting the simple LED on and off example on the Arduino, the LED doesn't turn on or off when I press the switch.
EDIT 2: Re-configured the Nano and it works now. Original problem still here though!