Arduino on Raspberry

Install Arduino on Buster

  1. Arduino 1.8.12 (or higher) from arduino.cc – Software – Arduino ARM 32 bits
  2. Download to e.g. Downloads
  3. cd /Downloads
  4. tar -x -f arduino-1.8.5-linuxarm.tar.xz
  5. cd arduino-1.8.12
  6. sudo ./install.sh
  7. and Arduino appears in Home – Programming desktop

Install Freepascal/Lazarus again

For Buster see here!

Installed using instructions from several posts by Thaddy as follows:

1. Add stretch-backports to sources.list

Create:   sudo nano /etc/apt/sources.list.d/backports.list
Add:      deb http://ftp.debian.org/debian stretch-backports main

Update:   sudo apt-get update

Ignore complaints about not signed

2.  FPC 3.0.4 and Lazarus 1.8.4 are both in stretch-backports

Use apt or apt-get, need to install with the -t option.
Answer Y to install without verification.

sudo apt-get -t stretch-backports install fpc
sudo apt-get -t stretch-backports install lazarus

Ignore complaints about not verified

Shutdown Raspbian with a button

he simplest way to set up a “pushbutton to shut down” is to add “dtoverlay=gpio-shutdown” to /boot/config.txt and rig a NO momentary contact switch across pins 5 and 6. Push once to shut down the system. Push again to reboot it.

dtoverlay=gpio-shutdown,gpio_pin=3

To avoid I2c being unusable:GPIO26 is physical pin 37
dtoverlay=gpio-shutdown,gpio_pin=26

pi@raspberrypi:~ $ dtoverlay -h gpio-shutdown
Name:   gpio-shutdown

Info:   Initiates a shutdown when GPIO pin changes. The given GPIO pin
        is configured as an input key that generates KEY_POWER events.
        This event is handled by systemd-logind by initiating a
        shutdown. Systemd versions older than 225 need an udev rule
        enable listening to the input device:

                ACTION!="REMOVE", SUBSYSTEM=="input", KERNEL=="event*", \
                        SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", \
                        ATTRS{keys}=="116", TAG+="power-switch"

        This overlay only handles shutdown. After shutdown, the system
        can be powered up again by driving GPIO3 low. The default
        configuration uses GPIO3 with a pullup, so if you connect a
        button between GPIO3 and GND (pin 5 and 6 on the 40-pin header),
        you get a shutdown and power-up button.

Usage:  dtoverlay=gpio-shutdown,=

Params: gpio_pin                GPIO pin to trigger on (default 3)

        active_low              When this is 1 (active low), a falling
                                edge generates a key down event and a
                                rising edge generates a key up event.
                                When this is 0 (active high), this is
                                reversed. The default is 1 (active low).

        gpio_pull               Desired pull-up/down state (off, down, up)
                                Default is "up".

                                Note that the default pin (GPIO3) has an
                                external pullup.
The default GPIO is 3 (which appears on pin 5 of the 40-pin header). The pin is configured to pull high by default (which is also the SoC's default), and the GPIO is marked as active low (the opposite to the pull, for obvious reasons).

If you are having trouble, you can debug using raspi-gpio on Raspbian. Assuming for now that the overlay applied correctly (lsmod should show gpio-keys as being loaded), raspi-gpio get 3 will show the pin level (which should be 1) and function (INPUT). Now run it in a loop:

pi@raspberrypi:~ $ while true; do raspi-gpio get 3; done
Attach one end of a patch lead to pin 5 (GPIO3), and touch the other end on pin 6 (GND) - the Pi should shut down immediately, but if not you will see the pin level change to 0.