w -> increase both wheels
a -> decrease both wheels
d -> increase right wheel
s -> decrease right wheel
x -> brake
require 'io/console'
$stdin.raw {
10.times {
case $stdin.getc
when "w" then print "up\r\n"
when "s" then print "down\r\n"
when "d" then print "right\r\n"
when "a" then print "left\r\n"
end
}
}
There is a program in the root called like gpio-admin. It lets you write to the pins. I took the code from here
$ sudo gpio-admin export 7
$ echo out > /sys/devices/virtual/gpio/gpio7/direction
$ echo 1 > /sys/devices/virtual/gpio/gpio7/value
Despite choosing pin 7, the wire is pin 26. I figured that out by comparing this chart to this map.