This completes getting Blinky running as a shell script on a Dragonboard 410c
echo 938 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio938/direction
while [ $a -lt 4 ]
echo $a ON
echo "1" > /sys/class/gpio/gpio938/value
echo $a OFF
echo "0" > /sys/class/gpio/gpio938/value
echo 938 > /sys/class/gpio/unexport
In Part 1 the script existed on the development system. It was piped to adb shell on the target using the command:
>type blinky.sh | adb shell
Reminder: The > in these snippets is just meant to indicate the prompt. Don’t include it when trying these commands.
We can copy the script to the target and run it directly from the adb shell. The question is where can we copy it to and ultimately where can we run it.
>push blinky.sh /sdcard/blink.sh
cat /sdcard/blinky.sh > $home/blink.shcd $home
This gets the script in place to run on target.
cat blinky.sh | sh
The above mimics how we previously piped the development system to adb shell.sh is the Linux shell on the target, similar to the Biourne shell.
So the shell script is the equivalent to a batch file.We can though run the script as a parameter to the shell as below:
We can also make the script executable. $home was chosen as the folder to place the script because on /sdcard it couldn’t be made runnable.
We use chmod to make the script runnable, as below The first 7 means it can be read, written and executed. You may prefer more restrictive settings than the other two sevens, but that doesn’t impact being to run it directly from the shell.
chmod 777 blinky.sh
We now run it as follows:
It would now be “nice” to create a compiled .c app to perform Blinky. That might (?) be possible by NDK. Please leave a comment if you have any ideas.
Part 3 will will demonstrate input through GPIO, where the LED is turned on and off with a press button.