Skip to content

Instantly share code, notes, and snippets.

View aallan's full-sized avatar

Alasdair Allan aallan

View GitHub Profile
@aallan
aallan / mac-vendor.txt
Last active December 8, 2024 13:30
List of MAC addresses with vendors identities
000000 Officially Xerox
000001 SuperLAN-2U
000002 BBN (was internal usage only, no longer used)
000003 XEROX CORPORATION
000004 XEROX CORPORATION
000005 XEROX CORPORATION
000006 XEROX CORPORATION
000007 XEROX CORPORATION
000008 XEROX CORPORATION
000009 powerpipes?
@aallan
aallan / async_webserver.py
Created July 4, 2022 15:38
An asynchronous webserver written in MicroPython to turn an LED on/off on a Raspberry Pi Pico W
import network
import socket
import time
from machine import Pin
import uasyncio as asyncio
led = Pin(15, Pin.OUT)
onboard = Pin("LED", Pin.OUT, value=0)
@aallan
aallan / ap_webserver.py
Created July 7, 2022 13:43
Running a web server on an wireless Access Point for Raspberry Pi Pico W in MicroPython
import socket
import network
import machine
ssid = 'MicroPython-AP'
password = '123456789'
led = machine.Pin("LED",machine.Pin.OUT)
ap = network.WLAN(network.AP_IF)
import network
import socket
import time
import struct
from machine import Pin
NTP_DELTA = 2208988800
host = "pool.ntp.org"
@aallan
aallan / hello_world.py
Last active October 18, 2024 06:04
Hello World example for the RP2040 1.28-inch TFT display watch board
"""
"Hello World!"
For https://www.tindie.com/products/adz1122/pi-pico-rp2040-128-inch-tft-display-watch-board/
Using GC9A01 Display Driver for MicroPython (https://github.com/russhughes/gc9a01_mpy)
DISPLAY
=======
Pin
@aallan
aallan / lcd_imc_test.py
Created March 13, 2023 11:35
Micropython example code for the RP2040 1.28-inch TFT display watch board
'''
I2C_SDA -> 6
I2C_SDA -> 7
DC -> 8
CS -> 9
SCK -> 10
DIN -> 11
RST -> 12
BL -> 25
BAT_ADC -> 29
@aallan
aallan / watch_code.py
Last active September 19, 2024 16:59
Example MicroPython watch code for the RP2040 1.28-inch TFT display watch board
# Digital Watch Face
#
# Author: Tony Goodhew (28th January 2023)
# Updates: Toby Roberts, Andrew Scheller & Alasdair Allan (March 2023)
#
# Original code taken from https://www.instructables.com/Digital-Watch-Display-MicroPython/
from machine import Pin,I2C,SPI,PWM
import framebuf
import time
@aallan
aallan / bmp280.py
Last active September 17, 2024 08:17
Vindriktning webserver for Raspberry Pi Pico W written in MicroPython
from micropython import const
from ustruct import unpack as unp
# Author David Stenwall (david at stenwall.io)
# See https://github.com/dafvid/micropython-bmp280
# SPDX-License-Identifier: MIT
# Power Modes
BMP280_POWER_SLEEP = const(0)
BMP280_POWER_FORCED = const(1)
@aallan
aallan / server_notcached.py
Created April 10, 2018 12:04
A non-caching version of Python's SimpleHTTPServer
#!/usr/bin/env python
import SimpleHTTPServer
class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_my_headers()
SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)
def send_my_headers(self):
self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")
@aallan
aallan / coco_labels.txt
Created April 22, 2019 14:23
Labels for the Mobilenet v2 SSD model trained with the COCO (2018/03/29) dataset.
1 person
2 bicycle
3 car
4 motorcycle
5 airplane
6 bus
7 train
8 truck
9 boat
10 traffic light