The fragility is annoying when we program scripts for Scratch 3. I hope there might be some fool proofs in or s3r.
On such aulty OneGpio Raspberry Pi blocks, s3r on RasPi necessarily aborts. Then s3r and S3OneGPIO and Scratch script of the problem must be restarted manually.
I have encounter two cases. There might be potentially faulty blocks more.
A. block 'Tone Pin [PIN] [FREQ] Hz [DURATION] ms'
If FREQ is zero, s3r aborts. The intention of zero FREQ was a silence which is synchronous with before and after tones.
The cause of abort is a simple zero division. As a workaround I barely found that FREQ 1 works for me.
/usr/local/lib/python3.7/site-packages/s3_extend/gateways/rpi_gateway.py
pin at the frequency and duration requested.
frequency = int(payload['freq'])
frequency = int((1000 / frequency) * 1000)
B. block 'Write PWM Pin [PIN] [VALUE]%'
If VALUE is negative or larger than 100, s3r aborts. These are primitive coding bugs of Scratch script. Nevertheless, that is annoying,
By the way, I devised a hack to restart s3r automatically. Aborted s3r revives several times surely. Though I am not sure why this hack works for me. I put the following code into /etc/rc.local.
(
while (true) do
if ps -ae | grep -w s3r > /dev/null ; then
sleep 10
if [ x$DONE = "x" ] ; then
DONE=Y
else
break
fi
else
/usr/local/bin/s3r
fi
done
) &
Thanks for S3ONeGPIO.
The fragility is annoying when we program scripts for Scratch 3. I hope there might be some fool proofs in or s3r.
On such aulty OneGpio Raspberry Pi blocks, s3r on RasPi necessarily aborts. Then s3r and S3OneGPIO and Scratch script of the problem must be restarted manually.
I have encounter two cases. There might be potentially faulty blocks more.
A. block 'Tone Pin [PIN] [FREQ] Hz [DURATION] ms'
If FREQ is zero, s3r aborts. The intention of zero FREQ was a silence which is synchronous with before and after tones.
The cause of abort is a simple zero division. As a workaround I barely found that FREQ 1 works for me.
/usr/local/lib/python3.7/site-packages/s3_extend/gateways/rpi_gateway.py pin at the frequency and duration requested. frequency = int(payload['freq']) frequency = int((1000 / frequency) * 1000)
B. block 'Write PWM Pin [PIN] [VALUE]%'
If VALUE is negative or larger than 100, s3r aborts. These are primitive coding bugs of Scratch script. Nevertheless, that is annoying,
By the way, I devised a hack to restart s3r automatically. Aborted s3r revives several times surely. Though I am not sure why this hack works for me. I put the following code into /etc/rc.local.
( while (true) do if ps -ae | grep -w s3r > /dev/null ; then sleep 10 if [ x$DONE = "x" ] ; then DONE=Y else break fi else /usr/local/bin/s3r fi done ) &