

By the way, other microcontrollers also have specific modules with functions/methods, mostly extensions for the module machine. More about this in the third part to this blog series. After importing, you can also look at a little help for this: Then all immediately available Python modules are displayed:įor the RP Pico there is another "built-in" module called rp2. Here you will find the reference to help('modules') in the last line. Have you already seen the reference to help() in the line before the prompt? This was easy, because the used modules are part of the program package. The temperature values for all elements of the list are then determined and output in the for loop. After instantiating the object ds, the single-wire bus is scanned and the unique identifiers of the sensors are entered in the list roms list. In the lower part of the program the module ds18x20 is imported first. In the upper part onewire is imported and the object ow is instantiated. Again, I copied the program fragments from the documentation and added them to an executable program. With the above program, the three approximately equal temperatures are measured and output in the shell. I try to connect several temperature sensors DS18B20 in parallel to one input. Like any electronic device, the sensor also needs a power supply, so the red wire to 3.3V and the black one to GND. Please don't forget the pull-up resistor (4.7 kOhm) between signal wire and 3.3V. The circuit is very simple: The namesake "one" wire goes to pin 12 in my project. First of all you need the OneWire library and then the library for the temperature sensor based on it. Single wire bus (One Wire) at the example of the temperature sensor DS18B20įor the popular temperature sensor DS18B20, I myself prefer the waterproof variant There are two modules that make programming very easy. I2C IIC adapter serial interface for LCD display

HD44780 1602 LCD module display 2x16 characters Raspberry Pi Pico RP2040 microcontroller boardĭS18B20 digital stainless steel temperature sensor temperature sensor Īlso the MicroPython documentation, and especially the chapter RP2 I would like to cite again as a source. This time, I would like to show you the programming of the familiar interfaces OneWire, UART and I2C, all of which are secondary pin assignments.įirst of all once again the reference to the official Pinout diagram.

In the first part we had the installation of Thonny, the setup of the Raspberry Pi Pico, as well as the first application programs for using the inputs and outputs.
