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
def get_vsys(): | |
# Pico W voltage read function by darconeous on reddit: | |
# https://www.reddit.com/r/raspberrypipico/comments/xalach/comment/ipigfzu/ | |
conversion_factor = 3 * 3.3 / 65535 | |
import network | |
from machine import Pin, ADC | |
wlan = network.WLAN(network.STA_IF) | |
wlan_active = wlan.active() | |
try: |
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
import plasma | |
from plasma import plasma2040 | |
import time | |
# Random functions! We'll be using randrange for picking integers from a range, and uniform for floats. | |
from random import randrange, uniform | |
from pimoroni import RGBLED, Button | |
from machine import Pin | |
led = RGBLED(plasma2040.LED_R, plasma2040.LED_G, plasma2040.LED_B) | |
led.set_rgb(0, 0, 0) |
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
""" | |
This example connects to the Carbon Intensity API to give you a regional forecast of how | |
your (UK) electricity is being generated and its carbon impact. | |
Carbon Intensity API only reports data from the UK National Grid. | |
Find out more about what the numbers mean at: | |
https://carbonintensity.org.uk/ | |
Make sure to uncomment the correct size for your display! |
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
import time | |
from machine import Pin, ADC, UART | |
from picographics import PicoGraphics, DISPLAY_ENVIRO_PLUS | |
from pimoroni import RGBLED, Button | |
from breakout_bme68x import BreakoutBME68X, STATUS_HEATER_STABLE | |
from pimoroni_i2c import PimoroniI2C | |
from breakout_ltr559 import BreakoutLTR559 | |
from pms5003 import PMS5003 | |
import WIFI_CONFIG | |
from network_manager import NetworkManager |
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
from enviro.helpers import get_config, connect_to_wifi | |
from enviro import logging | |
import urequests, ujson, os | |
import machine | |
import ubinascii | |
def upload_readings(): | |
if not connect_to_wifi(): | |
logging.error(f" - cannot upload readings, wifi connection failed") |
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
# This example reads Inky Frame's system voltage | |
# and estimates how much charge is left in the battery | |
# Save this code as main.py if you want it to run automatically! | |
from machine import ADC, Pin | |
import time | |
from picographics import PicoGraphics, DISPLAY_INKY_FRAME | |
# these are our reference voltages for a full/empty battery, in volts |
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
import badger2040 | |
import time | |
from breakout_bme68x import BreakoutBME68X | |
from pimoroni_i2c import PimoroniI2C | |
display = badger2040.Badger2040() | |
WIDTH = badger2040.WIDTH | |
HEIGHT = badger2040.HEIGHT |
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
#!/usr/bin/env python3 | |
from time import sleep | |
import weatherhat | |
import json | |
import paho.mqtt.client as mqtt | |
import paho.mqtt.publish as publish | |
sensor = weatherhat.WeatherHAT() |
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
#!/usr/bin/env python3 | |
from time import sleep | |
import weatherhat | |
from Adafruit_IO import Client, Feed, Dashboard, RequestError, AdafruitIOError | |
import json | |
import paho.mqtt.client as mqtt | |
import paho.mqtt.publish as publish | |
sensor = weatherhat.WeatherHAT() |