< IchigoJam BASIC RPi/RPi+

IchigoJam BASIC RPi+1.2 Documents

[2018/08/10]

日本語版(Japanese Edition) >

IchigoJam BASIC RPi + is an enhanced version of IchigoJam BASIC RPi,
It has special commands supporting Sense Hat and Touchscreen Display.
You can use it by purchasing pre-installed microSD card or introductory kit
released from I-O DATA. (Available in Japan)
For IchigoJam BASIC RPi (free edition), please see IchigoJam BASIC RPi1.2 Documents.

1. Terms of use

Agree to the Terms of use before use it. Distribution to third parties requires a contract.

2. Device compatibility

Basically, it should work with all models of Raspberry Pi.
Compatibility is confirmed with the following models.

* For some keyboards, The response of "Zero", "Zero W" and "Model A+" is not good for now.
However, Other than that, you can use those same as "Pi 3" and "Pi 2".

For Sense Hat and Touchscreen Display,
Compatibility is confirmed with the following models.

3. How to obtain

Please purchase the following products released from I-O DATA.

Update

To update to the latest version, follow the procedure below.

* Since updating the SAVE and LOAD command specifications to support EEPROM with ver1.2.5, it may be necessary to adjust the file name in the "files" directory at the time of update. Please see "SAVE/LOAD Destination" for details.

  • Using a PC, copy files in the microSD memory card to the desired location.(backup)
  • Download and unpack the latest version of IchigoJam BASIC RPi+ from the URL described in the package.
  • Overwrite the file on the microSD card with the file generated by downloading and unpacking it.
  • Copy (restore) files directory, config.txt, keymap.txt from backup to microSD card.

4. How to use

Configure the default keyboard layout

To configure the default keyboard layout, edit keymap.txt in microSD card.

Text in keymap.txt Keyboard layout
us US layout
jp Japanese layout

* Changing the keyboard layout after startup is also available by using KBD command.
(refer to the document below.)

Tutorial

I. Start IchigoJam BASIC

  • Insert the microSD card into Raspberry Pi.
  • Connect display device and keyboard.
  • Connect USB cable to turn on the power.

If the screen looks like the one on the left, it's successful!

II. Turn on the LED

Input "LED1" from keyboard and press [Enter] key.

If the Activity LED (green one) on Raspberry Pi turned on,
it's successful!

III. Turn off the LED

Input "LED0" from keyboard and press [Enter] key.

If the Activity LED (green one) on Raspberry Pi turned off,
it's successful!

IV. Blinking LED

  • Input "10 LED1: WAIT30" from keyboard and press [Enter] key.
  • Input "20 LED0: WAIT30" from keyboard and press [Enter] key.
  • Input "30 GOTO10" from keyboard and press [Enter] key.
  • Input "RUN" from keyboard and press [Enter] key.

If the Activity LED (green one) on Raspberry Pi blinking,
it's successful!

To stop blinking, press [Esc] key.

5. Differences from the original edition

IchigoJam BASIC RPi is ported based on version 1.2.4(1.2b56)(*) of the original edition (LPC1114 edition).
The operation method and available commands are basically same as the original edition,
but the following points are different.
A Document of the original edition is here. https://ichigojam.net/IchigoJam-en.html

* ver1.2.5 or later. Before ver1.2.4, ported based on ver1.2.3 of LPC1114 edition.

Unimplemented key operations

Following key operations are not implemented in RPi edition

Key Reaction of the original edition
[Ctrl] + [Shift] Switching Kana input mode(same as [kana])
[Ctrl] + [Alt] Switching insert mode(same as [Insert])

Key operations specific for RPi edition

Following key operations are implemented in RPi edition only

Key Reaction of the RPi edition
[Ctrl] + [Shift] + [K] Switching Kana input mode(same as [kana])
[Ctrl] + [Alt] + [I] Switching insert mode(same as [Insert])

Unimplemented commands

Following commands are not implemented in RPi edition

Command Reaction of the original edition Reaction of the RPi edition
SWITCH Change the Display Do nothing
SLEEP Enter to the system sleep mode Do nothing
ANA Return voltage of external input as a numerical value Always returns 0

Commands specific for RPi edition

Following commands are implemented in RPi edition only(*1)

Command Reaction of the RPi edition Usage
KBD Change the keyboard layout(*2) KBD 0 'Swicthing To US
KBD 1 'Swicthing To Japanese
IoT.IN Receive numerical values from sakura.io with I2C
  • Receive from all channels
  • Regardless of the transmission data type, the lower 2 bytes are handled as 16 bit integer with sign
?IoT.IN() 'Display received numerical value
IoT.OUT Send numerical value to sakura.io with I2C
  • Send on channel 0
  • The data type is an unsigned 64 bit integer. (L, 0x4c)
IoT.OUT 111 'Send 111

*1 IoT.IN and IoT.OUT are implemented in LPC1114 edition in beta version.

*2 From ver1.2.5, the setting is saved in keymap.txt with the KBD command.

* The numerical value returned by LANG and the numerical value set by KBD are different.
LANG returns the language number of the font to be displayed when enabling Kana input with IchigoJam in use.
(LPC1114 edition 1:Japanese, 2:Mongolian, 3:Vietnamese)

SAVE/LOAD Destination

The save destination of the program by the SAVE, LOAD command is as follows.
With ver1.2.5, we changed the specification to support EEPROM.
When updating from ver1.2.4 or earlier to ver1.2.5 or later, adjust the file name in the "files" directory of the microSD card to take over the created program.

microSD card(In the "files" directory) EEPROM
ver1.2.4 or earier 0 to 3 and 100 to 227 (*.bin) [Not supported]
ver1.2.5 or later 0 to 99 (*.bin) 100 to 227

Etc.

In addition, there are following differences.

  • If power is turned on without connecting the keyboard, FILE0 is automatically executed (LRUN0)
  • Only PWM3 and PWM4 can be used for PWM command
  • IN3(OUT10) becomes a pull-up input with OUT10,-2 command
  • LED command and OUT7 command are independent of each other
  • Power saving mode of WAIT command is not supported
  • With the FILES command without parameters, It behaves equivalent to FILES20 (ver1.2.5 or later)
  • Clock down capability of VIDEO0 command is not supported (ver1.2.5 or later)
  • USR command supports Thumb instruction set for Pi / Pi Zero series and Thumb 2 instruction set for Pi 2 / Pi 3 series (ver1.2.5 or later)

6. IO commands and physical pin layout

IN/OUT/PWM

The relationship between IN/OUT/PWM command and the physical pin
where the electric current actually flows is as follows.

Physical pin Input command Output command PWM command Initial state
15 IN1 (OUT8) Input(pull up)
13 IN2 (OUT9) Input(open)
11 IN3 (OUT10) Input(open)
7 IN4 (OUT11) Input(pull up)
35 IN9 Input(open,fixed)
37 (IN5) OUT1 Output
36 (IN6) OUT2 Output
33 (IN7) OUT3 PWM3 Output
32 (IN8) OUT4 PWM4 Output
38 (IN10) OUT5 Output
40 (IN11) OUT6 Output
26 OUT7 Output(fixed)

I2C

The physical pin where the electric signal actually flows
by using I2CW/I2CR command is as follows.

Physical pin function
3 SDA
5 SCL

UART

The physical pin where the electric signal actually flows
when communicate using UART is as follows.

Physical pin function
8 TXD
10 RXD

BEEP/PLAY

The physical pin where the electric signal actually flows
by using BEEP/PLAY command is as follows.

Physical pin function
29 SND

Pinout

7. Known issues and planned actions

Known issues

  • [issue 1005] For some keyboards, The response of "Zero", "Zero W" and "Model A+" is not good.
  • [issue 1008] I2CW returns zero (success), in situations where non-zero (failure) should be returned, such as access to a nonexistent address.

Planned actions

  • Improvement of key input processing. (related to issue 1005)

Fixed Issues

  • [issue 1009] LED command does not work on Raspberry Pi 3 Model B+.
  • [issue 1007] The cursor does not blink.
  • [issue 1006] The value of TICK and the number of screen refreshes are not synchronized.
  • [issue 1004] Screen changes by CLS, SCROLL, POKE, COPY, CLP are not reflected until the next PRINT processing.
  • [issue 1003] Auto repeat does not work on some keyboards.
  • [issue 1002] Shift, Ctrl, Alt do not work on some keyboards.
  • [issue 1001] Home, End, Page Up, Page Down, Ins on the Numeric Keypad do not work on some keyboards.

Change log

[2018/06/07] ver1.2.6
  • [issue 1009] has been fixed
[2018/06/01] ver1.2.5
  • sakura.io was supported(IoT.IN, IoT.OUT command)
  • A display related function was supported(VIDEO command)
  • Sound related functions were supported(BEEP, PLAY, TEMPO, SOUND command)
  • A machine language related function was supported(USR command)
  • EEPROM was supported, the save destination of the program was changed(SAVE, LOAD command)
  • Behavior of FILES command without parameters was changed(From FILES 3 equivalent to FILES 20 equivalent)
  • Behavior of KBD command was changed to save setting in keymap.txt
  • Font anti-aliasing was disabled(scaling_kernel = 8 added to config.txt)
  • Specification changes in 1.2.4(1.2b56) of LPC1114 edition were incorporated
    • Behavior of FILES0,0 was changed to display only file 0
    • A command for suppression of error message was changed from OK0 to OK2
    • It was changed to completely ignore spaces between commands
    • Now, It can be set the communication speed of I2C using the second parameter of the BPS command ex)BPS0,100 'Set to 100kHz
    • Switching of kana input mode by [Right Alt] + [K] was removed
    • [Right Alt] was changed to work the same way as [Left Alt]
    • [Alt] + [W] was changed to work the same way as [Alt] + [0]
    • [Alt] + [X] was changed to work the same way as [Alt] + [1]
    • [Alt] + [Y] was changed to work the same way as [Alt] + [2]
    • [Alt] + [Z] was changed to work the same way as [Alt] + [3]
  • Added support for Sensors of Sense HAT
    • Gyroscope sensor
    • Magnetometer sensor
    • Barometric pressure sensor (pressure,tempreture)
    • Humidity sensor (humidity,tempreture)
  • Simplify connection of Touchscreen Display (without SDA and SCL cable)
[2017/12/25] ver1.2.4
  • [issue 1007] has been fixed
  • [issue 1006] has been fixed
  • Screen rendering processing has been improved.(related to issue 1006, 1007)
[2017/12/09] ver1.2.3
  • [issue 1004] has been fixed
ver1.2.2
  • [issue 1003] has been fixed
  • [issue 1002] has been fixed
  • [issue 1001] has been fixed

8. FAQ

Q. The screen flips vertically, when using "Raspberry Pi 7 inch Touchscreen Display".
A. It can be adjusted by adding lcd_rotate=2 to config.txt as with Raspbian.
Q. There is no button on the raspberry pi, how to start the program automatically when turn on the power?
A. If power is turned on without connecting the keyboard, FILE0 is automatically executed (LRUN0).
Q. Can Composite Video (RCA terminal) be used for display output?
A. Yes. Similar to Raspbian, a signal is output from the 3.5 mm jack. The sound is output from the physical PIN 29 (SND).
Q. I want to use a Japanese keyboard.
A. You can switch it with the KBD command. Try KBD1.
Q. I want to use a US keyboard.
A. You can switch it with the KBD command. Try KBD0.
Q. Does it support analog input?
A. No. Use external modules such as AD Converter connecting via I2C and so on.

9. Support

For inquiries, please contact below.

Natural Style Co. Ltd.
IchigoJam BASIC RPi Team (support@na-s.jp)

Also, for technical information sharing and questions, please use the following Facebook group. https://www.facebook.com/groups/ichigojamfan/

10. RPi+ special command

IchigoJam BASIC RPi+ has the following special command which supports Sense HAT and Touchscreen Display.
These commands can not be used with IchigoJam BASIC RPi. (Free edition)

Commands support Sense HAT

Command Reaction of the RPi+ edition Usage
SH.CLS Turn off all Sense HAT LEDs
SH.CLS
SH.CLS 'Turns off all
SH.PUT Set the color of Sense HAT's LED
SH.PUT {Horizontal position}, {Vertical position}, {Color:0-4095}
Color example(White:#FFF, Red:#F00, Green:#F0, Blue:#F)
'Make the LED 4th from the left end and 4th from the top end green
SH.PUT 3, 3, #F0
SH.SCR Get the color of Sense HAT's LED
SH.SCR({Horizontal position}, {Vertical position})
'Show the color of LED 4th from the left end and 4th from the top end
?SH.SCR(3, 3)
SH.SCROLL Scroll through the Sense HAT LEDs
SH.SCROLL {direction}
Examples of directions(Up:0, Right:1, Down:2, Left:3)
SH.SCROLL 0 'Scroll up
SH.SCROLL 1 'Scroll to the right
SH.AX
SH.AY
SH.AZ
Get the acceleration in each axis direction from the acceleration sensor
SH.AX()
SH.AY()
SH.AZ()
?SH.AX() 'Show acceleration in X axis direction
?SH.AY() 'Show acceleration in Y axis direction
?SH.AZ() 'Show acceleration in Z axis direction
SH.BTN Get the state of the joystick
SH.BTN()
0th bit from the right: Selecting "Down"
1st bit from the right: Selecting "Rigiht"
2nd bit from the right: Selecting "Up"
3rd bit from the right: Pushing
4th bit from the right: Selecting "Left"
'Show the state of the joystick in binary number at once.
?BIN$(SH.BTN(),5)
SH.BUP Get whether the joystick is in the Selecting "Up"
SH.BUP()
'Show 1 when the joystick is in the Selecting "Up"
?SH.BUP()
SH.BDOWN Get whether the joystick is in the Selecting "Down"
SH.BDOWN()
'Show 1 when the joystick is in the Selecting "Down"
?SH.BDOWN()
SH.BLEFT Get whether the joystick is in the Selecting "Left"
SH.BLEFT()
'Show 1 when the joystick is in the Selecting "Left"
?SH.BLEFT()
SH.BRIGHT Get whether the joystick is in the Selecting "Rigit"
SH.BRIGHT()
'Show 1 when the joystick is in the Selecting "Righit"
?SH.BRIGHT()
SH.BPRESS Get whether the joystick is in the Pushing
SH.BPRESS()
'Show 1 when the joystick is in the Pushing
?SH.BPRESS()
SH.GX
SH.GY
SH.GZ
(ver1.2.5 or later)
Acquire angular velocity of each axis from Gyroscope sensor
SH.GX()
SH.GY()
SH.GZ()
?SH.GX() 'Show angular velocity of X axis
?SH.GY() 'Show angular velocity of Y axis
?SH.GZ() 'Show angular velocity of Z axis
SH.MX
SH.MY
SH.MZ
(ver1.2.5 or later)
Get magnetic flux density in each axis direction from the Magnetometer sensor
SH.MX()
SH.MY()
SH.MZ()
?SH.MX() 'Show magnetic flux density in X axis direction
?SH.MY() 'Show magnetic flux density in Y axis direction
?SH.MZ() 'Show magnetic flux density in Z axis direction
SH.APRESS
(ver1.2.5 or later)
Get a 10 times value of the atmospheric pressure
SH.APRESSS()
'Show atmospheric pressure in units of hectopascals
?SH.APRESS()/10
SH.HUMID
(ver1.2.5 or later)
Get a 100 times value of the humidity
SH.HUMID()
'Show humidity in percent
?SH.HUMID()/100
SH.TEMP
(ver1.2.5 or later)
Get a 100 times value of the temperature from the humidity sensor
SH.TEMP(), SH.TEMP(1)

Get a 100 times value of the temperature from the Barometric pressure sensor
SH.TEMP(2)
'Show temperature in degrees Celsius
?SH.TEMP()/100

Commands support Touchscreen Display

Command Reaction of the RPi+ edition Usage
TS.X
TS.Y
Get the touched location of Touchscreen
TS.X() Horizontal position (0-799, Not touched:-1)
TS.Y() Vertical position (0-479, Not touched:-1)
?TS.X() 'Show horizontal position
?TS.Y() 'Show vertical position
TS.GET Get the touched location of Touchscreen
TS.GET()
Leading 8bit: Horizontal position (0-199, Not touched:0)
Later 8bit: Vertical position (0-119, Not touched:0)
'Show the touched location repeatingly.
10 P=TS.GET()
20 ?(P>>8);" ";(P&#FF)
30 WAIT10: GOTO10

With ver1.2.5, we changed the specification to support Easy connection of Touchscreen Display.
How to of the connection in each version and the definition of the origin of coordinates acquired by each command are as follows.
Please refer to the explanation here when connecting Touchscreen Display.

How to connect Origin of coordinates
ver1.2.5 or later Connect ribbon cable and power cable
upper left origin
ver1.2.4 or earlier Connect below
  • ribbon cable
  • power cable
  • Raspberry Pi's physical pin 3 (SDA) and Touchscreen Display's SDA
  • Raspberry Pi's physical pin 5 (SCL) and Touchscreen Display's SCL
lower right origin