This completes getting Blinky running as a shell script on a Dragonboard 410c


The Blinky Script from Part-1



echo 938 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio938/direction

while [ $a -lt 4 ]
    #Loop counter
    a=$(( a+1))
    echo $a ON
    echo "1" > /sys/class/gpio/gpio938/value
    sleep 1
    echo $a OFF

    echo "0" > /sys/class/gpio/gpio938/value
    sleep 1

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 | 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.


  • We can copy it from the command prompt to /sdcard which is an emulated sdcard on teh target.
  • We can then copy it from there to $home from within the adb shell.
  • Files are copied to and from the target using adb push and adb pull.


>push /sdcard/
>adb shell
cat /sdcard/ > $home/
cd $home

This gets the script in place to run on target.

cat | 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


We now run it as follows:


Winking smile




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.