arduino / arduino-iot-cloud-py

Arduino IoT Cloud Python Client.
Mozilla Public License 2.0
28 stars 2 forks source link

Micropython documentation and usage #68

Open anglerfish27 opened 1 year ago

anglerfish27 commented 1 year ago

Hello again, I am trying to figure out how to get a temperature reading from a SHT45 sensor to display (and update) in the IoT cloud with no user interaction.

I was able to get it to display the temp upon initially running the code on a gauge widget. However it never updated with new readings.

Now I have been messing with it so much I can't even get it to display that initial reading.

Can we please have a clear document on how to use "client.XXX" and on_read and on_write ect with examples that dont just revolve around the one toggle switch that turns on the internal LED.

The sensor works I ran it in MP without trying to connect to the cloud works fine. Like I said I did have it at one point providing the initial temp value upon running the code in thonny but I have since broken that too :(.

The reading is coming via I2C to I2C1 on pins 18/19. I also found a pin out diagram that is quite different than what you have on your website that appears to be accurate. See here (link is safe). https://www.nextech.sk/files/photo/2021-07/85443/adf9a9/Snimka-obrazovky-2021-07-05-152813.png

I feel like virtually no attention is being given to MP on IoT at least for the RP2040Connect. Which I struggle with because of this.. https://store-usa.arduino.cc/products/arduino-nano-rp2040-connect?selectedStore=us which clearly shows its compatible AND supported by MP. I know it is hence this github repo exists. But we need more information. Having to dig into the other python modules it calls when you connect to try and figure things out is tough. It simply shouldn't be that way. Please help on what a shell for reading an I2C device and displaying to the cloud with it auto updating with no user interaction needed. That will at least keep me going until more documentation comes (I hope its coming, I'm finding my own questions on the arduino board when I google search and no other hits virtually, under 5. Thats wild. I get this may be a new thing but more people who use MP are going to want and need proper and complete documentation, for every board that is supported. For example I'm sure you have seen Adafruits product website and the "learn" portion they show you everything from loading MP to multiple examples, code and they detail everything great and have pictures and diagrams and pinouts as needed.

I'm still confused on the sample LED toggle MP code (which has always worked) Its calling "LEDB" which turns on/off a blue light on the nano2040. Yet per your own pin out PDF how is anyone supposed to know this? https://content.arduino.cc/assets/Pinout_NanoRP2040_latest%20%281%29.png

Respectfully and thank you in advance, Anglerfish27.

iabdalkader commented 1 year ago

Can we please have a clear document on how to use "client.XXX" and on_read and on_write ect with examples that dont just revolve around the one toggle switch that turns on the internal LED.

Have you seen the MicroPython example here https://github.com/arduino/arduino-iot-cloud-py/blob/main/examples/example.py#L82 ? There are at least 6 or 7 documented examples using different cloud objects (see the clk object sounds closer to what you want to do)

As for MicroPython examples/docs on RP2040, see the generic MicroPython docs for rp2 port https://docs.micropython.org/en/latest/rp2/quickref.html and the Arduino docs/tutorials here https://docs.arduino.cc/hardware/nano-rp2040-connect