Product Details
Scratch (http://scratch.mit.edu/) is a popular free software package used in schools to introduce simple computer programming. A PICAXE-18M2 system (e.g. the BOT115 Create system) can be used to send real life signals (switch presses, light levels, position etc.) to the Scratch software so that the program can react to these changing conditions.
Note that Scratch is not a programming language for the PICAXE chip itself – the PICAXE chip just acts as an ‘interface’ to the computer, as it is the computer that ‘runs’ the Scratch program. Therefore the PICAXE chip is simply programmed once (with the 'picoboard emulation' firmware) and from that point on it acts as an interface to the Scratch software. To create PICAXE programs using “flowcharts” see Logicator and to create PICAXE programs using “Scratch-like” blocks see the 12Blocks software instead.
Note that the original MIT version of Scratch only supports input interfacing, so it cannot control ‘real-life’ outputs such as lights, motors etc. To overcome this problem the school can choose to use the S4A software instead of Scratch. S4A is a modified build of Scratch that supports control of outputs via additional ‘output’ and ‘motor’ sprites. See the S4A section below for more details.
Using PICAXE with Scratch
The PICAXE BOT115 Create board (or any other board fitted with a PICAXE-18M2) can be used as an input device to the original Scratch software by emulating the officially supported Scratch interface, which is called 'picoboard'. The PICAXE board provides up to 7 sensors to the Scratch program (note that the original MIT build of Scratch does not control output devices, as the picoboard is an ‘input only’ device).
You will also need the AXE027 PICAXE USB cable to connect the board to the computer.
Quick Start:
As Scratch will think it is using the picoboard, the software actually has no idea that you are using a PICAXE system instead of the original picoboard. So all the generic Scratch help instructions for setting up and connecting a picoboard will also apply to using the PICAXE version board.
Setup your BOT115 motherboard with the Create modules as shown here (not all are required, choose what you want to use).
|
Picoboard pin name
|
PICAXE function
|
PICAXE pin
|
|
Button
|
Push Switch
|
C.0
|
|
Slider
|
Slider or Potentiometer
|
C.1
|
|
Light
|
Light (LDR)
|
C.2
|
|
Sound
|
Not Used
|
|
|
A
|
Analogue Sensor
|
B.7
|
|
B
|
Analogue Sensor
|
B.6
|
|
C
|
Analogue Sensor
|
B.5
|
|
D
|
Analogue sensor
|
B.4
|
- Download the ‘picoboard.bas’18M2 firmware file and program into the PICAXE-18M2 chip on the BOT115 Create motherboard (using the PICAXE Programming Editor or AXEpad software). This then makes your PICAXE system emulate a picoboard.
- Within Scratch click on the Sensing section and then right click over the ‘sensor’ sprite
- Click the ‘Show Scratchboard watcher’ menu
- Right Click over the Scratchboard Watcher window, click ‘Select Serial/USB port’ and then click the COM port allocated to the AXE027 PICAXE USB cable.
- You can then use Scratch to develop programs that react to the various sensors. Note that at this time the PICAXE system does not emulate the sound sensor (under development).
Using PICAXE with S4A (modified version of Scratch)
S4A (http://seaside.citilab.eu/) is based upon the Scratch 1.4 source, but has been extended to add new motor, servo and digital outputs (as outputs are not supported in the original MIT Scratch). This allows Scratch to control real-life outputs as well as respond to real-life sensors.
The PICAXE BOT115 Create board (or any other board fitted with a PICAXE-18M2) can be used with S4A to control outputs and respond to inputs. The open-source PICAXE firmware code could also be modified to work with any M2 or X2 PICAXE chip.
You will also need the AXE027 PICAXE USB cable to connect the board to the computer.
Quick Start:
As S4A uses the generic picoboard protocol for hardware interfacing, the software has no idea which type of interface you are actually using (PICAXE, Arduino etc). Therefore any Help file instructions for other interfaces will also apply to the PICAXE interface. You do not need to install any other software apart from the actual S4A installation itself.
Setup your BOT115 motherboard with the Create modules as shown here (not all are required, choose what you want to use).
|
S4A name
|
PICAXE function
|
PICAXE 18M2 Pin
|
|
Analog1
|
Analogue Sensor e.g.LDR
|
C.0
|
|
Analog2
|
Analogue Sensor
|
C.1
|
|
Analog3
|
Analogue Sensor
|
C.2
|
|
Analog4
|
Not Used
|
|
|
Analog5
|
Not Used
|
|
|
Analog6
|
Not Used
|
|
|
Digital1
|
Digital input e.g. button
|
C.6
|
|
Digital2
|
Digital input
|
C.7
|
|
|
|
|
|
Digital10
|
Digital output e.g. LED
|
B.0
|
|
Digital11
|
Digital output
|
B.1
|
|
Digital13
|
Digital output
|
B.2
|
|
Analog5
|
Not Used
|
|
|
Analog6
|
Not Used
|
|
|
Analog9
|
Not Used
|
|
|
Motor4
|
DC Motor (L293D)
|
B.4 and B.5
|
|
Motor7
|
DC Motor (L293D)
|
B.6 and B.7
|
|
Motor8
|
Servo
|
B.3
|
|
Motor12
|
Not Used
|
|
- Download the ‘s4a.bas’18M2 firmware file and program into the PICAXE-18M2 chip on the BOT115 Create motherboard (using the PICAXE Programming Editor or AXEpad software). This then makes your PICAXE system emulate a picoboard.
- Within S4A click on the Motion section and click the ‘show board’ sprite.
- Right Click over the Board Watcher window, click ‘Select Serial/USB port’ and then click the COM port allocated to the AXE027 PICAXE USB cable (you may need to click ‘Stop Searching’ first).
- You can then use S4A to develop programs that react to the various sensors and control the motors/outputs. Some examples are provided in the zip file.