With scratchClient, it is possible to connect multiple scratch instances with events. ScratchClient can combine this feature with other adapters, as GPIO or alike.
To demonstrate a ‘chain reaction’ type application, I have connected six scratch screens in a 2*3-array to have a red dot traverse the screens.
As I do not own 6 hdmi-monitors for scratch, I have collected 6 vnc-sessions with 600*400-resolution on a desktop computer. The video is taken from this machine.
Each scratch instance sends a specific start broadcast to the next scratch instance to trigger the display-move-hide sequence there. So Instance 0 sends ‘start_1’, instance 1 sends ‘start_2’ and so on. Instance 5 sends ‘start_0’ and the sequence starts again.
The sample is in the scratchClient-distribution, scratch/chainReaction-folder. If you want to run this sample, you need six raspberry computers. Start scratch/chainReaction/reaction_0.sb on each of the raspberryPi. Change the value of ‘whoami’ to 0, 1, 2.. 5 and arrange the screens in
0, 1, 2
5, 4, 3
order.
On one of the computers, the scratchCommunicationServer needs to be started.
cd ~/scratchClient python src/scratchCommunicationServer.py
For each of the computers, there is a distinct computer-specific config script. Adjust the
<parameter name="server" value="192.168.2.90" />
in the config-files to match the ip-address of the server computer.
For computer 0, use config_start_0.xml:
cd ~/scratchClient sudo python src/scratchClient.py -c scratch/chainReaction/config_start_0.xml
and start scratchClient on other computers with config_start_<N>.xml, N=1..5.
The remote connection adapter can be combined with other adapters like GPIO or whatever needed. This is the reason to start the python application with sudo.
The current configuration combines the remote communication adapter with a GPIO output on GPIO18. This is a feature unique to scratchClient.