# To make a CP device stop auto-reloading code,
<code>
import supervisor
supervisor.runtime.autoreload = False # CirPy 8 and above
print("supervisor.runtime.autoreload = False")
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
#!/bin/bash | |
# Open the Weewx page | |
# other flags are possible. which? | |
chromium-browser --start-fullscreen http://pi4/weewx/Crandard & |
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
#!/bin/bash | |
# back up weewx | |
# as per https://www.weewx.com/docs/4.10/usersguide.htm#backup | |
# param: $1: archive name (date?) | |
# will create directory in cd | |
# run this as root to only get prompted once for pw (if that) | |
BASE_NAME=$1 |
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
# Based on code from Adafruit Industries | |
# SPDX-License-Identifier: MIT | |
"""Rob's CircuitPython blink example for built-in NeoPixel LED""" | |
import time | |
import board | |
import neopixel | |
import random | |
k = 20 # number of steps up or down |
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
# For the Adafruit miniPiTFT 3.3" LCD display: turn the backlight on/off (usually off). | |
# robcranfill | |
import board | |
import digitalio | |
import sys | |
def set_backlight_state(backlight_on: bool) -> None: | |
backlight_ = digitalio.DigitalInOut(board.D22) | |
backlight_.switch_to_output() |
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 microcontroller | |
microcontroller.on_next_reset(microcontroller.RunMode.BOOTLOADER) | |
microcontroller.reset() |
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
# Test outputting stereo audio via a PCM5102 board | |
# cran, based on: | |
# SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries | |
# SPDX-License-Identifier: MIT | |
import board | |
import audiocore, audiobusio, audiomixer, synthio | |
# Pico |
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
# put this in .bashrc - or .bash_aliases? | |
function mountcirc() { | |
# mount drive $1 to /mnt/CIRCUITPY | |
sudo mount -t drvfs $1 /mnt/CIRCUITPY/ | |
echo "Mounted $1 to /mnt/CIRCUITPY" | |
ls -l /mnt/CIRCUITPY | |
} |
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
# to see the name of the file(s) on the device: | |
import os | |
os.listdir() | |
# to run the code | |
# (ok actually you would do this in a separate step) | |
exec(open('code.py').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
#!/bin/bash | |
# copy work files from thumbdrive to a folder here | |
# params: {new folder name} | |
NEWFOLDER="$1" | |
mkdir "$NEWFOLDER" | |
cp /mnt/f/*py "$NEWFOLDER" | |
ls -Al /mnt/f/lib >>"$NEWFOLDER"/liblist.text | |
tree /mnt/f/ >>"$NEWFOLDER"/dirtree.text |
NewerOlder