scratchClient ist Software, die einen Zugriff von scratch zur Hardware ermöglicht. Auf dem RaspberryPi ist das Ansteuern der GPIO möglich, Lesen von Analogwerten über SPI, aber auch Sprachausgabe oder Netzwerkkommunikation.
Download und Dokumentation hier.
The architecture of the scratchClient is centered around adapters. Broadcasts and variables from scratch are routed to adapters; adapters can send broadcasts/variables.
Which broadcasts/variables are routed is defined by configuration only and is very flexible. There is a mapping layer which converts scratch names to adapter method names.
The scratchClient is a framework, which communicates with scratch, reads configurations and brings adapters in action. A web interface complements for monitoring.
Adapters are small classes with a well defined interface towards the framework. Adapters can control one GPIO line, an ADC, Stepper or alike, but what the do with broadcasts is very flexible. I have build a text to speech interface, for example.
Not to forget: there can be multiple adapters active in one setup (4 buttons, two adc, one pwm or whatever is needed).
And as adapters have no ‘knowledge’ on other adapters, implementing new ones has almost no side effects to the system.
Scratch 1.4 on raspberry pi allows to connect with other scratch instances on other computers. This is an experimental feature. This feature is not available in scratch1.4 for linux or windows, not in scratch2. With this feature multiple scratch 1.4 can share events and (global) variables. As this feature is experimental, there are some constraints […]
There was a question on how to edit scratchClient config files. There was the need to add a Button to a GPIO. Button inputs are handled by a GPIOEventInput-Adapter. This short walkthrough will not explain all the details but will concentrate on where to find the files use an editor copy / paste an adapter […]
Did you ever want to control GPIO from scratch2 ? Or other sensors connected to a raspberry pi ? The last days I worked on connecting scratch2 with GPIO on raspberry and more. To be precise, this is done by either using scratchx or since june 2017 with the standalone version of scratch2 for raspbian. […]
Sonic Pi is great software to produce sounds and to program melodies. Sonic Pi has an API which allows to use some of the program statements from an external program. There are some places in the web where this feature is used with erlang- or ruby-code. This adapter for scratchClient and the programming in scratch […]
There is a nice little led matrix moard from PIMORONI, “SCROLL PHAT HD”. The form factor is for the pi zero, but it runs well also with a pi 3. scratchClient offers support for this board. The interface allows to set pixel with brightness, write large and somewhat smaller text and of course clear the […]
MQTT Description MQTT, Message Queue Telemetry Transport, is a is an ISO standard for a publish-subscribe based messaging protocol. It is based on TCP/IP (the ‘usual’ network protocol) and especially designed for small devices and low network bandwidth. A typical infrastructure contains at least one MQTT-Broker and one to many clients connected to the broker. […]
scratchClient needs to run alone, as a ‘singleton’, on one computer. The reason is that concurrent access to GPIO, SPI or other resources could result in unpredictable results. First approach was to use a pid-file with some logic. At startup, scratchClient writes its own process identification ‘pid’ into a file scratchClient.pid. When another scratchClient is […]
For the ‘pi and more 9‘ in Trier on 11 june 2016, I had the chance to run a workshop on how to use scratch with gpioserver and as an alternative to use scratch with scratchClient. Basis setup was to control three LED with a button. The introduction is available as a pdf-document. The tutorials […]
LEGO has a nice set of controls named ‘powerfunctions’. The main device is a IR-receiver which can control motors, LED with a variety of functions. ON,OFF, PWM are available. To connect this to scratch I use an arduino to control the IR-LED. Arduino is connected by USB to raspberry pi. The LED is connected to […]
GPIO performance on raspberry pi is an often discussed topic. New scratch uses a build in gpioServer, other options are scratchClient. Especially stepper motors need quite high pulse rate, so I have set up a test harness for a small stepper with 2ms step width. The scenario are a DMA pulse driven approach a python […]