Create an object lcd to set up the I2C connection for the library. As we only have one I2C device connected, we only need to see the first address returned in the scan. Create a variable I2C_ADDR, which will store the first I2C address found when we scan the bus. Here we are using I2C channel 0, which maps SDA to GP0 and SCL to GP1. Create an object i2c to communicate with the LCD screen over the I2C protocol. Finally we import the I2C library to interact with the LCD screen. Next we import the sleep function from Time enabling us to pause the code. The first two are from the Machine library and they enable us to use I2C and GPIO pins. Import four libraries of pre-written code. With the libraries installed we can now start writing a test script to demonstrate the library functions.Ģ. Save the file to the Raspberry Pi Pico as pico_i2c_lcd.py Programming an I2C LCD Screen with Raspberry Pi Pico Create a blank file in Thonny and paste the text into it. Open this link and copy the text from the page. Save the file to the Raspberry Pi Pico as lcd_api.pyĩ. Open this link and copy the text from the page.Ĩ. Click on STOP to confirm your Pico is connected.ħ.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |