update RPI + Arduino
Posted by kll on January 19 2019 12:14:18
link Processing Arduino by USB
-1- Firmata again
-2- Arduino send full text JSON
-3- Arduino Serial Menu to processing Terminal


-0- intro


for some time i worked Processing ( esp. forum work )

and mostly using the RPI 3B+ board as computer, as my old win 7 PC has 2 bad hard drives,
and i soon might buy a new PC / ok the old/slow win 7 laptop still works.



i check on Arduino IDE and see a update to
ARDUINO 1.8.8 2018.12.07
i have for RPI the arduinoinst.sh
arduinoinst.sh
#!/bin/sh
# arduino update
cd /home/pi/Downloads
rm -v arduino-nightly-linuxarm.tar.xz
sudo rm -r arduino-nightly
wget https://downloads.arduino.cc/arduino-nightly-linuxarm.tar.xz
tar xvJf arduino-nightly-linuxarm.tar.xz
cd arduino-nightly
echo 'setup arduino IDE'
./install.sh
# show version ( 1.8.2 == 1.8.1 ++ nightly )
sed -n '1p' revisions.txt
echo 'now pls try in desktop'

so i got the so called 1.8.9 rev now


-1- Firmata again


actually change of plans:
i see at the processing forum arduino questions,
what indicate that there it is not very clear
when to use the processing serial lib
or add the arduino lib, as even it is called arduino ( firmata )
one might think it is needed to talk to a arduino.
_________________________________________
so again:
if the arduino is loaded with a firmata sketch
the processing must use the arduino ( firmata ) lib
_________________________________________
now there are several versions and even several specialized add on libs.,
i want just use the
standard firmata
-A- arduino side





make a processing example read A0 write D5
and test with a jumper cable between the ports.

code:


-2- Arduino send full text JSON


a older forum 4um question was about how to transport data
( like from arduino to processing using USB )
where i recommended sending lines in CSV style
> 1023,1023,1023
or even full text JSON.
well, after i said that, i needed to proof its structural advantage.
it was actually easy on win 7 laptop USB Arduino Leonardo,
now on RPI USB Arduino UNO face several issues
* reduce baudrate
* change to readStringUntil(lf)
* catch JSON exception

code:

code:



-3-- Arduino Serial Menu to processing Terminal


also because that is a new RPI setup ( just for processing play )
i need to load a old arduino sketch.
[ i have in google drive the old sketch dirs now zipped /
so i use on win 7 the total commander to look into the zip file,
select the dir. i need
/menu_kll_v30/
( my default multi tasking / time sliced / USB menu handler / prototype
what is the basis of many of my play projects )

and copy it over network to the \\Rpi3bp\share\ ( a samba share )
on the RPI move from the /desktop/share/ dir to the projects/arduino/sketchbook/
here using the MC midnight commander ]


RPI: in arduino IDE set board "arduino UNO" and verify [OK] upload
and start arduino IDE monitor ( terminal )





on the RPI processing side ( using Processing 3.4 ( RPI armhf ) )
i want start here with a forum question,
using old CP5 for layout of buttons and textarea and processing.serial
to build a kind of TERMINAL software
( but can not type "out" text and send,
instead there are 2 buttons to send something?
we will see later about that concept )

code txt