Skip to content

Instantly share code, notes, and snippets.

View qbalsdon's full-sized avatar

Quintin Balsdon qbalsdon

View GitHub Profile
# 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)
# 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()
@qbalsdon
qbalsdon / PicoBricksIRSensor.py
Created July 19, 2024 11:05
PicoBricks: Read value from IR sensor and output to serial
# 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
# 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