MachiKania type P

MachiKania type P (aka MachiKania phyllosoma) runs a BASIC compiler on Raspberry Pi Pico to control LCD, MMC etc

Similar projects worth following
MachiKania type P (aka MachiKania phyllosoma) runs a BASIC compiler (structured and object oriented BASIC language) on Raspberry Pi Pico to control LCD, MMC, and other peripherals (SPI, I2C, PWM UART, and ADC).

This project is a collaboration with KenKen (

MachiKania type P is an open source platform that runs BASIC program on Raspberry Pi Pico ($4!). It is connected to 320x240 LCD and MMC/SD card, so it can read files in the card and displays the result of BASIC program execution on the LCD.

The source code and ZIP archive package are available in github page ( ).

The BASIC isn't an interpreter but compiler. The BASIC system (aka KM-BASIC) compiles BASIC codes to ARM Cortex-M0 native code for the fastest execution speed.

The BASIC language is compatible to the ones of the other MachiKania computers (type M, type Z, and web), so the programs are easily transported among the types.

This photo shows an example of running a game BASIC program, SPACE ALIEN (provided as a sample in ZIP package). KM-BASIC provides the enough speed to run many games written in BASIC as it generates ARM native code.
The LCD is 320x240 resolution; 256 color photo can be displayed by BASIC code (full color photo can be also shown by a small hacking).

This is the initial screen. One can select a file by the cursor buttons (blue and green ones in picture) and run it by the fire button (red in picture). To view the source code of BASIC file, press the start button (yellow in picture).

The syntax of BASIC language is described in help-e.txt file in documents folder of ZIP archive (repository: The help file is translated by computer from Japanese one. Therefore, if there are somethings wrong, or confusing, please let me know.

The BASIC language supports following programing styles:

  • classical line number BASIC
  • structured BASIC
  • object oriented BASIC (class based)

For the detail of object oriented programing, please refer class-e.txt in document folder (

MachiKania type P can be used as not only a game console but also an I/O controller. By simple BASIC codes, one can control SPI, I2C, UART, PWM, and A/D converter.

SPI接続LEDマトリクスThe photo is an example of controlling SPI-LED module by MachiKania type P (provided by KenKen). Following is the program to control this device:
REM SPI LED Matrix x8 (MAX7219 LED Driver)
SPI 10000,16,0:REM 10MHz/16bit/Mode0

REM Not Test Mode

REM Not Shutdown Mode

REM No Decode Mode

REM Set Briteness

REM Scan All LEDs

DIM F(63)
FOR I=0 TO 63

FOR Y=0 TO 7
 SPIWRITE D+F(Y),D+F(8+Y),D+F(16+Y),D+F(24+Y),D+F(32+Y),D+F(40+Y),D+F(48+Y),D+F(56+Y)

CDATA $38,$6C,$C6,$FE,$C6,$C6,$C6,$00:REM A
CDATA $FC,$66,$66,$7C,$66,$66,$FC,$00:REM B
CDATA $3C,$66,$C0,$C0,$C0,$66,$3C,$00:REM C
CDATA $F8,$6C,$66,$66,$66,$6C,$F8,$00:REM D
CDATA $FE,$C0,$C0,$F8,$C0,$C0,$FE,$00:REM E
CDATA $FE,$C0,$C0,$F8,$C0,$C0,$C0,$00:REM F
CDATA $3C,$66,$C0,$CE,$C6,$66,$3C,$00:REM G
CDATA $C6,$C6,$C6,$FE,$C6,$C6,$C6,$00:REM H

Photo is an example of controling LED-tape (containing 144 LEDs) by MachiKania type P (programmed by KenKen). For a movie, please refer this page.

自動実行To control I/O, the LCD and MMC/SD card aren't necessary. One can embed BASIC program to MachiKania type P and install to naked  Raspberry Pi Pico (photo by KenKen), For the detail, please refer embed-e.txt in documents folder ( and my blog page (google translated).

For BASIC program development, one can connect a PC to MachiKania type P. Any editor in PC can be used for writing BASIC code. When the reset button of MachiKania, the file(s) are transferred from PC to MachiKania through USB connection. For detail, please refer pcconnect-e.txt in document folder (
Read more »

  • 1 × Raspberry Pi Pico
  • 1 × ILI9341 LCD (SPI interface) - MMC/SD card slot combo
  • 1 × MMC/SD card
  • 1 × PCB board
  • 2 × 20 pin male headers

View all 17 components

  • Ver 1.1.0

    Katsumi10/02/2022 at 23:28 0 comments

    MachiKania type P ver 1.1.0 was released on 10/01/2022.

    • Fixed a bug that prevented compiling when using another class in a class
    • Fixed a bug in static function calls of the class
    • Allow assignment of strings and arrays to object fields
    • Fixed a bug that WAVE files stop playing after a certain period of time
    • Allows use of WAIT, DELAYMS, and DELAYUS statements during interrupts
    • Fixed a bug that caused MUSIC statements to stop with an error in some environments
    • The NOT#() function was added.

  • Ver 1.0.0

    Katsumi10/02/2022 at 23:27 0 comments

    MachiKania type P ver 1.0.0 was released on 8/27/2022. This is the first published version.

View all 2 project logs

  • 1
    Construct your board

    Construct your own board according to the circuit:schematic.png

  • 2
    Get the ZIP archive and copy the files to MMC/SD card
  • 3
    Install the MachiKania type P firmware

    Drag & drop the "phyllosoma.uf2" in ZIP archive to RPI-RP2 drive of Raspbery Pi PIco

View all 4 instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates