Code Monkey home page Code Monkey logo

picos's Introduction

PicOS

This repo contains the resources and code needed to play games on the Raspberry Pi Pico with the Pico Unicorn accessory.

These games are written in Python and have been developed for MicroPython with the picounicorn package.

GAMES!

Pong - a nice little competitive game between friends

Snake - a decent distraction when trying to think through problems!

pico_snake.mp4

Getting Started

Assuming you have all the hardware setup (Pico, header pins and Unicorn display) you need to do the following as prerequisites to getting any Pico Unicorn code to run:

  • If you haven't used the Pico before download either Thonny or VSCode with the Pico extension.
  • If already loaded with a UF2 then the Pico needs resetting with the flash nuke.
  • Load the Pico Unicorn version of MicroPython updates can be found here. This allows you to use the picounicorn package on the Pico.

I personally use Thonny on a Raspberry Pi 4 because it completely simplifies the setup so all I have to worry about is code.

Running Code on your Pico!

The Pico works in a really simplistic way. Anything uploaded to the root called main.py will be ran automatically.

This is the start of an extremely simplified OS for the Pico so for the time being it'll give you a list of importable games from the games subdirectory. To run this as a whole copy all .py files across to your Pico and both pong.py and snake.py will be options available to you. To exit out of these games press A + X together.

TODO:

  • PicoGame abstraction - both pong and snake contain code that can be abstracted out, ideal for an Abstract Base Class!
  • Text scrolling - I bashed this together using existing code for displaying the game scores but it would be best if it scrolled the other way for the menu.
  • Customisation - I'd LOVE to build in options so game booleans (like walls in snake or infinite looping paddles in pong) can be toggled on/off. Also custom colours. Store these in a JSON on the Pico and they'll persist too!
  • More games and other things!! Like a tiny calculator or game high scores ... the possibilities are endless.

Thanks

Firstly I need to give a shout out to pippayy and her PONG.py code. Without stumbling on her LinkedIn video I wouldn't have started this project and the Picos I preordered would've gathered dust for a little while longer. I used her project as a starter for 10, did a little refactoring, fixed a couple of bugs then got to work on my own take on a classic :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.