Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Solutions to Exercise 4: The I2C Bus and the SHT30 Temperature and Humidity Sensor | ||||||||
Added: | ||||||||
> > | Exercise 1:After initializing of the I2C bus with from machine import Pin,I2C i2c = (id=-1,scl=Pin(22),sda=Pin(21)) where the id parameter defines the I2C bus:
| |||||||
Exercise 2:This is an extremely relevant exercise because it shows typical work that must be done during an IoT project. Often code from other authors can be found on the Internet (e.g. github) but often you find problems with this. Maybe it is
| ||||||||
Changed: | ||||||||
< < | Still, starting from something that has worked before or worked on a different hardware is often (not always!) easier than starting from scratch. And reading code written be experienced programmers may help you to improve your own coding skills. | |||||||
> > | Still, starting from something that has worked before or worked on a different hardware is often (not always!) easier than starting from scratch. And reading code written by experienced programmers may help you to improve your own coding skills. | |||||||
A quick tryAfter having uploaded mysht30.py I simply copy the first example to a Python script and modify the import statement: | ||||||||
Line: 65 to 81 | ||||||||
Now that we know how to read and write the SHT30 using the ESP32 I2C driver, we can make the necessary corrections in the SHT30 class. After the change all the code snippets in the README.md file should work.
Improving the SHT30 class | ||||||||
Added: | ||||||||
> > | First I made a table with all functions the SHT30 offers and their command codes. I also checked which functions are implemented in the above SHT30 driver. See SHT30NopI2CTemperatureAndHumiditySensor for details about the development of the driver. | |||||||
-- ![]() Comments |