Skip to content

Instantly share code, notes, and snippets.

View samneggs's full-sized avatar

Sam samneggs

View GitHub Profile
@samneggs
samneggs / mode7.py
Created July 30, 2022 22:52
Affine Transformation and Perlin Noise Generated Sky
from machine import Pin, SPI
import gc9a01
import framebuf, array
from time import sleep, ticks_diff, ticks_us
from math import sin,cos,radians
from micropython import const
from uctypes import addressof
import gc
from usys import exit
from random import randint
@samneggs
samneggs / matrixclock.py
Created June 4, 2022 21:40
RGB 64x32 Matrix Clock
from machine import Pin, Timer
from time import sleep_ms, sleep_us, ticks_diff, ticks_us, sleep, localtime
from usys import exit
import framebuf, array
from uctypes import addressof
from micropython import const
import _thread
from random import randint
import gc
@samneggs
samneggs / matrix565.py
Created June 4, 2022 13:34
LED 64x32 matrix driver and demo.
from machine import Pin, Timer
from time import sleep_ms, sleep_us, ticks_diff, ticks_us, sleep, localtime
from usys import exit
import framebuf, array
from uctypes import addressof
from micropython import const
import _thread
from random import randint
import gc
@samneggs
samneggs / sand2_asm.py
Created May 23, 2022 16:08
Falling Sand and Water, single assembly routine for both threads
import gc9a01
from gc9a01 import color565
from machine import Pin, SPI, PWM, WDT, freq
import framebuf
from time import sleep_ms, sleep_us, ticks_diff, ticks_us, sleep
from micropython import const
import array
from usys import exit
import gc
from random import randint
@samneggs
samneggs / sand_asm.py
Created May 22, 2022 23:46
Falling Sand and Water
import gc9a01
from gc9a01 import color565
from machine import Pin, SPI, PWM, WDT, freq
import framebuf
from time import sleep_ms, sleep_us, ticks_diff, ticks_us, sleep
from micropython import const
import array
from usys import exit
import gc
from random import randint
@samneggs
samneggs / ski_game.py
Created May 9, 2022 01:33
Skiing game on Pi Pico in inline assembly with gc9a01 display
import gc9a01
from machine import Pin, SPI, PWM, WDT
import framebuf
from usys import exit
import _thread
import array, gc
from time import sleep_ms, sleep_us, ticks_diff, ticks_us, sleep
from uctypes import addressof
from micropython import const
@samneggs
samneggs / Lander_1bp.py
Created April 14, 2022 16:49
Luner Lander using 1 bit plane on Pi Pico.
#Lunar Lander 1 bit plane
import gc9a01
from machine import Pin, SPI, PWM, WDT
import framebuf
from time import sleep_ms, sleep_us, ticks_diff, ticks_us, sleep
from micropython import const
import array
from usys import exit
from math import sin,cos,pi,radians,tan, degrees, atan2
@samneggs
samneggs / pallet16.py
Created April 13, 2022 01:23
16 color pallet to RGB565 on Pi Pico in MicroPython and inline assembly
import gc9a01
from machine import Pin, SPI, PWM, WDT
from math import sin,cos,radians
import array, micropython, framebuf
import _thread, gc
from time import sleep_ms, sleep_us, ticks_diff, ticks_us, sleep
from sys import exit
from uctypes import addressof
MAXSCREEN_X=const(240)
@samneggs
samneggs / LCD_1inch14.py
Created March 5, 2022 05:04
Asteroids game using PI Pico and WaveShare LCD 1.14 v2
from machine import Pin,SPI,PWM
import framebuf
import time
BL = 13
DC = 8
RST = 12
MOSI = 11
SCK = 10
CS = 9
@samneggs
samneggs / asteroids_threaded.py
Created March 3, 2022 04:44
Asteroids on Pi Pico
from LCD_1inch14 import LCD_1inch14
from machine import Timer, reset, WDT,PWM,Pin
from math import sin,cos,radians
#import sys #uselect
from random import randint
from sys import exit
import _thread, array
import gc
#import micropython