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 | |
import board | |
from adafruit_pyportal import PyPortal | |
from adafruit_button import Button | |
from adafruit_slideshow import PlayBackOrder, SlideShow, PlayBackDirection | |
# Set the background color | |
BACKGROUND_COLOR = 0x000000 | |
# Setup PyPortal without networking |
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 requests | |
from time import sleep | |
url = "https://petition.parliament.uk/petitions/241584/count.json" | |
def get_count(): | |
count = None | |
while True: | |
r = requests.get(url) | |
if r: |
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
# CircuitPython IO demo #1 - General Purpose I/O | |
import time | |
import board | |
from digitalio import DigitalInOut, Direction, Pull | |
switch = DigitalInOut(board.D2) |
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 pyaudio | |
import wave | |
FORMAT = pyaudio.paInt16 | |
CHANNELS = 2 | |
RATE = 44100 | |
CHUNK = 1024 | |
RECORD_SECONDS = 30 | |
WAVE_OUTPUT_FILENAME = "file.wav" | |
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 os | |
files = os.listdir("/directory/with/files/in") | |
print(list(filter(lambda x: 'mp3' in x, files))) |
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 more options and information see | |
# http://www.raspberrypi.org/documentation/configuration/config-txt.md | |
# Some settings may impact device functionality. See link above for details | |
# uncomment if you get no picture on HDMI for a default "safe" mode | |
#hdmi_safe=1 | |
# uncomment this if your display has a black border of unused pixels visible | |
# and your display can output without overscan | |
#disable_overscan=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
import serial, time | |
#Change the port to match the port that you will be using, Windows uses COM3 etc | |
port = "/dev/ttyACM0" | |
baud = 115200 | |
while True: | |
s = serial.Serial(port) | |
s.baudrate = baud | |
s.parity = serial.PARITY_NONE |
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 | |
import os | |
import RPi.GPIO as GPIO | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(23 , GPIO.IN) | |
while True: | |
counter = 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
from gpiozero import Button | |
from picamera import PiCamera | |
from datetime import datetime | |
from signal import pause | |
button = Button(18, pull_up=False) | |
camera = PiCamera() | |
def capture(): | |
datetime = datetime.now().isoformat() |
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 gpiozero import LED | |
from signal import pause | |
red = LED(17) | |
red.blink() | |
pause() |