Connect a jumper wire to the Lorikeet's GND pin. Then connect this pin to GND on the Pico.
00:00
Next connect a red jumper wire from + on the Lorikeet, to VBUS on the Pico.
00:00
Next, connect DIN on the Lorikeet to GPIO 0 on the Pico.
00:00
Start a new program in Thonny IDE and import the machine and utime libraries.
00:00
Next, set up the analogue-to-digital converter. Use the pin number 4 as this is the channel number connected to the Pico's temperature sensor.
00:00
We'll need a conversion factor to change the reading from the sensor into a voltage value. This is provided in the Raspberry Pi Pico documentation. So go ahead and create a new variable called conversion_factor. Assign it a value of 3.3 divided by 65535.
00:00
We've added new code at lines 6 to 55. This is necessary to control the Lorikeet WS2812B. We've assigned NUM_LEDs a value of 5 as this is the number of LEDs on the Lorikeet. As we've connected the digital input pin, DIN on the Lorikeet to GPIO0, set PIN_NUM to 0. The brightness value can be between 0 and 1, the higher the value, the brighter and more power-consuming the Lorikeet will be.
00:00
Add a condition so that when the temperature is detected as less than 20, the LEDs on the Lorikeet changes colour to blue. 
00:00
We use an elif statement to set a new condition. When the temperature is higher than or equals to 20 but less than 22 degree Celsius, the LEDs' colour turns to green.
00:00
Lastly, add an else statement, to turn the LEDs red. Run the following code in Thonny and you should see the temperature readings printed in the Shell. The Lorikeet's LEDs will now light up accordingly. 
00:00
main.py
xxx
Terminal
screen /dev/tty.usbmodem0000000000001 115200
>>> led = Pin(25, Pin.OUT)
>>> from machine import Pin
Breadboard
Breadboard
Mark
© 2022 Chick Commerce Pty Ltd