Skip to content

BlaT2512/ScratchSerialExtension

 
 

Repository files navigation

ScratchSerialExtension

Info

This is an edited version from amandaghassaei/ScratchSerialExtension to work with the new versions of the required libraries (SerialPort and Socket.io). This project is being maintained.

This is a Serial Communication extension for Scratch - it allows you to pass serial messages between the scratch interface and any serial device.

Usage

Serial communication happens through a node.js server that must be running concurrently with scratch.

You will need to download this repository to use the project.

To run the node server, first install node.js. This will also install the node package manager (npm), use npm to install the following dependencies from the terminal, serialport and socket-io:
npm install -g serialport
npm install -g socket.io

Navigate to the parent directory of this repo in the terminal and run node nodeServer.js to start the node server.

The go to this link and accept the warning: http://scratchx.org/?url=https://cdn.jsdelivr.net/gh/Blake-Tourneur/ScratchSerialExtension/serial_port_extension.js#scratch. You will see the blocks in the More Blocks tab.

Alternatively, go to the Scratch X editor, go to the More Blocks tab and click "Load Experimental Extension". Paste in the following link: https://cdn.jsdelivr.net/gh/Blake-Tourneur/ScratchSerialExtension/serial_port_extension.js. Accept the warning, and you will now see all the blocks in the More Blocks tab.

I used documentation from the Lifelong Kindergarten Group to set up the Scratch interface for this extension.

There is a sample Arduino sketch in this repo that listens for incoming serial messages and repeats them to test this Scratch extension. There is also a sample scratch project which can be loaded into ScratchX (File>>Load Project).

Attribution

Door sound effects from freesoundeffects.com
Bike Horn sound effect from soundbible.com
Swoosh sound effect from soundbible.com