Skip to main content

Kitronik Pico ZIP96 Retro Gamer

This repo contains the MicroPython library file for the Kitronik ZIP96 Retro Gamer for Raspberry Pi Pico.

To use the library you can save the ZIP96Pico.py file onto the Pico so it can be imported.

Also in this repo are some games in the Games folder which we have been created for the ZIP96 Retro Gamer.

These games include Snake written in MicroPython, and Run Along, Jump & Jump written in C.

We have also added a folder called A-Mazing Game Lesson Plans which contains a complete set of lesson plans for creating our A-Mazing Game in MicroPython for the ZIP96 Pico.

Below is a table to help you get started with each of these games. For the Run Along, Jump & Jump two player wireless version you will need two Kitronik ZIP96 Retro Gamers and two Raspberry Pi Pico Ws.

Game Language Files needed
Snake MicroPython
  • Snake.py
  • ZIP96Pico.py
A-Mazing Game MicroPython
  • A-Mazing Game folder
  • ZIP96Pico.py
Run Along, Jump & Jump C The Kitronik-Pico-ZIP96-C repo

How to use the ZIP96 for Pico

Below is a small section explaining how to use each component on the ZIP96 Retro Gamer.


Setup the ZIP96 Retro Gamer

To use the ZIP96 Retro Gamer for Pico we first need to import the library and setup our controller. To initialise our controller we can use the KitronikZIP96 class which will setup all of our buttons and the buzzer for us.

from ZIP96Pico import *
# Setup ZIP96 Retro Gamer for Pico
controller = KitronikZIP96()

Detecting button presses

To detect when a button has been pressed on our Retro Gamer we can use the pressed function on each of our buttons. As we don't know when a button is going to be pressed it is best to continuously check for them in a loop.

Inside of the loop we can then use a series of if statements to check when each button is being pressed. Inisde of each if statement we can respond to a button press by executing some code, such as playing a tone on the buzzer.

while True:
    if controller.Up.pressed():
        # Respond to Up button being pressed
    if controller.Down.pressed():
        # Respond to Down button being pressed
    if controller.Left.pressed():
        # Respond to Left button being pressed
    if controller.Right.pressed():
        # Respond to Right button being pressed
    if controller.A.pressed():
        # Respond to A button being pressed
    if controller.B.pressed():
        # Respond to B button being pressed

The Retro Gamer has some of the GPIO pins broken out so we can access them and customise our controller. Two of these pins are at the top of the controller and could be used for adding left and right shoulder buttons.

To setup the two shoulder buttons we can use the KitronikButton class inside the Mini Controller library. When initialising the shoulder buttons we need to give the GPIO pin number as the input for where each of our buttons are connected to.

# Setup additional Left Shoulder button
LeftShoulder = KitronikButton(11)
# Setup additional Right Shoulder button
RightShoulder = KitronikButton(0)

We can now use the shoulder buttons like we would any of the default buttons on the Retro Gamer.

if LeftShoulder.pressed():
    # Respond to Left Shoulder button being pressed
if RightShoulder.pressed():
    # Respond to Right Shoulder button being pressed

Using the buzzer

To use the buzzer on our Retro Gamer we have two different ways of playing a tone.

The first is to use the playTone function, then wait for a period of time, and finally use the stopTone function. In this code we ask the buzzer to play a tone at 500 Hz. Then we use the sleep function to wait for 1 second. And finally we stop playing the tone after we have waited for 1 second.

# Play tone at frequency 500 Hz
controller.Buzzer.playTone(500)
# Sleep for 1 second
sleep(1)
# Stop tone playing
controller.Buzzer.stopTone()

The second is to use the playTone_Length function. In this code we ask the buzzer to again play a tone at 500 Hz, but we also ask it to only play the tone for 50 milliseconds.

# Play tone at frequency 500 Hz for 50 milliseconds
controller.Buzzer.playTone_Length(500, 50)

Using the vibration motor

To use the vibration motor on our Retro Gamer we can use the Vibrate object.

To start the motor vibrating we simply use the vibrate function. Then when we want to stop the vibration motor we use the stop function. We can add a delay in between these two functions to control how long the Retro Gamer is vibrating for.

# Start motor vibrating
controller.Vibrate.vibrate()
# Wait for 1 second
sleep(1)
# Stop the controller vibrating
controller.Vibrate.stop()

Using the ZIPLED screen

Also on the Retro Gamer is a screen made up from 96 ZIPLEDs. The screen has a width of 12 ZIPLEDs and a height of 8 ZIPLEDs. Each ZIPLED can be changed separately with over 16 million possible colours and 100 brightness settings.

To update all 96 of the ZIPLEDs on the Retro Gamer screen we can use the fill function. The fill function takes 1 input which is the RGB values we would like the ZIPLEDs to be. For example, below we set all the ZIPLEDs to green by setting red to 0, green to 255, and blue to 0.

After updating any of the ZIPLEDs values we need to use the show function. This will push any changes in RGB values to the ZIPLEDs, and actually update the colours on the screen. Having the show function allows us to make multiple changes to the ZIPLEDs colours and update the screen all at once.

# Sets a new RGB colour for all ZIPLEDs
controller.Screen.fill((0, 255, 0))
# Updates all ZIPLEDs on the screen with the new ZIPLED values
controller.Screen.show()

To change the colour of only one ZIPLED we can use the setLEDMatrix function. This takes 3 inputs being the X location of the ZIPLED, the Y location of the ZIPLED, and the RGB colour. The X and Y locations start in the top left corner with this pixel being at 0, 0. For example, below we set the ZIPLED in the bottom right corner to purple. And remember to use show to update the screen.

# Sets a new RGB colour for a ZIPLED, using the x, y location
controller.Screen.setLEDMatrix(11, 7, (180, 0, 255))
# Updates all ZIPLEDs on the screen with the new ZIPLED values
controller.Screen.show()

To change the brightness of the Retro Gamer screen we can use the setBrightness function. This function takes 1 input for the brightness level you would like the ZIPLEDs to be. The brightness can be set from 0% to 100%. Below we set the brightness to 10%. And remember to use show to update the screen.

# Sets a new brightness level for all ZIPLEDs
controller.Screen.setBrightness(10)
# Updates all ZIPLEDs on the screen with the new ZIPLED values
controller.Screen.show()

Rather than using the X and Y location to change a ZIPLED, we can give the actual index of the ZIPLED using the setLED function. The ZIPLEDs are numbered from 0 to 95 with the ZIPLED in the top left being index 0. The index then increases by 1 for each ZIPLED along the top row, until the top right ZIPLED is at index 11. At this point we then jump to the second row of ZIPLEDs and start numbering from 12 going left to right. This continues to the bottom row, where the final ZIPLED in the bottom right corner is numbered 95.

For example, if we wanted to set the first ZIPLED on the fourth row to cyan we would use an LED number of 36. And remember to use show to update the screen.

# Sets a new RGB colour for a ZIPLED
controller.Screen.setLED(36, (0, 255, 255))
# Updates all ZIPLEDs on the screen with the new ZIPLED values
controller.Screen.show()

We can also retrieve the current RBG colour value for a given ZIPLED using the getLED function. To do this we simply provide the LED number, like we did for the setLED function above, and the RGB value for the ZIPLED is returned.

# Gets the current RGB colour for a ZIPLED
colour = controller.Screen.getLED(LED)

To remove the RGB colour value from an ZIPLED we can use the clear function. This will set the ZIPLED's colour to be black. The clear function again uses the LED number like the setLED function above. And remember to use show to update the screen.

# Sets a ZIPLED to be empty (black)
controller.Screen.clear(LED)
# Updates all ZIPLEDs on the screen with the new ZIPLED values
controller.Screen.show()

Metadata

Release files for KitronikPicoZIP96 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for KitronikPicoZIP96 1.0.2
File Size Uploaded
KitronikPicoZIP96-1.0.2.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for KitronikPicoZIP96 1.0.2
File Interpreter ABI Platform
KitronikPicoZIP96-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / KitronikPicoZIP96-1.0.2.tar.gz

Download URL KitronikPicoZIP96-1.0.2.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0ee8898130e72dc3153f070d778cc70c6ba37a5d71ba4d1f66f93563134900f9
BLAKE2b-256 checksum
How to use checksums
e7424b8ba3c247ab71e7ebf90d0c13315b58d2469ecd8266d9ea776c47865a5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / KitronikPicoZIP96-1.0.2-py3-none-any.whl

Download URL KitronikPicoZIP96-1.0.2-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
787dc4b03fb2c19c9a75f4c8e480dc2a05f18c28588c2787fba5b3cc6c1319a5
BLAKE2b-256 checksum
How to use checksums
424557ae1e6660b41b963de2dc384759ca89cead0b1ace0eb573e897c381c3c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page