Skip to content

Instantly share code, notes, and snippets.

View samneggs's full-sized avatar

Sam samneggs

View GitHub Profile
@samneggs
samneggs / minesweeper.py
Created April 20, 2024 04:20
Minesweeper Game in MicroPython on Pi Pico
# minesweeper
from lcd_1_8 import LCD_1inch8
import machine
from machine import Pin, PWM
from time import sleep, ticks_us, ticks_diff, ticks_ms
import gc, array
from sys import exit
from micropython import const
from random import randint
@samneggs
samneggs / bubble_darts.py
Created April 20, 2024 04:08
Balloon Pop Game in MicroPython on Pi Pico
# Bubble Darts
from lcd_1_8 import LCD_1inch8
import machine
from machine import Pin, PWM
from uctypes import addressof
from time import sleep, ticks_us, ticks_diff, ticks_ms, sleep_ms
import gc, _thread, array
from sys import exit
from micropython import const
from random import randint
@samneggs
samneggs / snake_asm.py
Created April 20, 2024 03:36
Classic Snake Game In Assembly on Pi Pico
# snake_asm
from lcd_1_8 import LCD_1inch8
import machine, math
from machine import Pin, PWM
from uctypes import addressof
from time import sleep, ticks_us, ticks_diff, ticks_ms
import gc, _thread, array
from sys import exit
from micropython import const
from random import randint
@samneggs
samneggs / invaders_sound.py
Created November 18, 2023 21:42
Space Invaders game on Pi Pico in MicroPython
from time import sleep, ticks_us, ticks_diff, ticks_ms, sleep_ms
import gc
import _thread, array
from machine import Timer, Pin, PWM
from sys import exit
class Game_Sound:
def __init__(self):
# index,start,dur,pause,number, volume
@samneggs
samneggs / plasma.py
Created September 8, 2023 04:02
Plasma Effect in MicroPython and Assembly
# plasma
from lcd_1_8 import LCD_1inch8
import machine
from machine import Pin, PWM
from uctypes import addressof
from time import sleep, ticks_us, ticks_diff, ticks_ms
import gc, _thread, array
from sys import exit
from micropython import const
from random import randint
@samneggs
samneggs / astro3.py
Created August 29, 2023 23:41
Astro Miner game on PI Pico in MicroPython
# AstroMiner
from lcd_1_8 import LCD_1inch8
import machine
from machine import Pin, PWM
from uctypes import addressof
from time import sleep, ticks_us, ticks_diff, ticks_ms, sleep_ms
import gc, _thread, array
from sys import exit
from micropython import const
from random import randint
@samneggs
samneggs / tetris.py
Created July 2, 2023 23:00
Tetris on PI Pico in MicroPython
# Tetris
import tetris_title
from lcd_1_8 import LCD_1inch8
import machine
from machine import Pin, PWM, Timer
from uctypes import addressof
from time import sleep, ticks_us, ticks_diff, ticks_ms
import gc, _thread, array
@samneggs
samneggs / Centipede.py
Created June 28, 2023 14:31
Centipede game on PI Pico in MicroPython
# Centipede
import centi_splash
from lcd_1_8 import LCD_1inch8
import machine
from machine import Pin, PWM
from uctypes import addressof
from time import sleep, ticks_us, ticks_diff, ticks_ms
import gc, _thread, array
@samneggs
samneggs / LCD_3inch5.py
Created June 8, 2023 21:28
LCD 3.5 inch driver
from machine import Pin,SPI,PWM,mem32,freq
import framebuf
from time import sleep_ms, sleep_us, ticks_diff, ticks_us
from micropython import const,heap_lock
import ustruct,gc
from random import randint
from usys import exit
LCD_DC = const(8)
LCD_CS = const(9)
@samneggs
samneggs / breakout_3_5.py
Last active June 8, 2023 21:27
Breakout game on 3.5" display in MicroPython
from LCD_3inch5 import LCD_3inch5
import framebuf, gc, _thread
from micropython import const
from machine import Timer, UART, Pin
#constants
BRICK_WIDTH = const(20)
BRICK_HEIGHT = const(10)
BALL_SIZE = const(5)
BALL_X_START = const(390)