This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Useful links | |
# https://randomnerdtutorials.com/raspberry-pi-pico-w-http-requests-micropython/ | |
URL="..." | |
import json | |
import network | |
import requests | |
# contents of cred.json (on Pico file system, where main.py is) | |
# { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PicoBricks output to OLED | |
# Thonny IDE | |
# Useful links: | |
# https://picobricks.com/blogs/robotic-stem-projects/thermometer | |
# https://github.com/Robotistan/PicoBricks/blob/cc9fe87cbb75d4305b4175dd691fd09f3d90fdeb/Software/Pre-Installed%20Code/picobricks.py#L660 | |
import utime # time library | |
from machine import Pin, I2C # to access the hardware | |
from picobricks import SSD1306_I2C # oled library on picobricks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PicoBricks read value from IR sensor and output to serial | |
# Thonny IDE | |
# Reference: https://picobricks.com/blogs/robotic-stem-projects/remote-test-project | |
from time import sleep | |
from machine import Pin | |
import machine | |
import time | |
from picobricks import NEC_16 | |
from picobricks import IR_RX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Library: | |
# https://github.com/danjperron/PicoDHT22 | |
from machine import Pin | |
from PicoDHT22 import PicoDHT22 | |
import utime | |
dht_sensor=PicoDHT22(Pin(11,Pin.IN,Pin.PULL_UP),dht11=True) | |
while True: | |
temperature,humidity = dht_sensor.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PicoBricks read value from potentiometer and output to serial | |
# Thonny IDE | |
# Helpful reference: https://www.halvorsen.blog/documents/technology/iot/pico/pico_potentiometer.php | |
from machine import ADC | |
import utime | |
VOLTAGE = 3.3 # from the power source | |
INT_MAX = 65535.0 # 2^16 is the max value for integers | |
adcpin = 26 | |
pot = ADC(adcpin) |