Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
curl -fsSL https://get.docker.com -o /tmp/get-docker.sh
sudo sh /tmp/get-docker.sh
sudo docker run hello-world
sudo usermod -aG docker pi
# restart shell
exit
  •  Create the “io.sh” script on your device

...

  • this file

Expand
title/home/pi/io.sh
Code Block
languagebash
#/bin/bash

# io.sh

#$1: file
#$2: offset
#$3: length
#$4: value
function writeByte() {
printf "$(printf '\\x%02X' $4)" | dd of="$1" bs=1 seek=$2 count=$3 conv=notrunc &> /dev/null
}

#$1: file
#$2: offset
#$3: length
function readByte() {
od -t x1 -j "$2" -N "$3" -Ad "$1"
}

echo "write 0 to address $1 in host $(hostname)..."
writeByte /dev/piControl0 $1 1 0
echo "read address $1 in host $(hostname):"
readByte /dev/piControl0 $1 1
echo
sleep 1
echo
echo "write 1 to address $1 in host $(hostname)..."
# value 3 => Pins 1 and 2
writeByte /dev/piControl0 $1 1 3
echo "read address $1 in host $(hostname):"
readByte "/dev/piControl0" $1 1

...

Code Block
languagebash
docker run -i -t --device=/dev/piControl0 -v /home/pi/files/io.sh:/io.sh debian bash /io.sh 70

The 24V LED should blink one time.

Page Properties
hiddentrue

Verwandte Vorgänge

Jira Legacy
serverId6a616e0c-dd66-30e3-95b5-0fa763638e21
keySUP-3072