Movial
STEricsson
NOTICE: Igloo Community services to be terminated 28.6.2013
Read more in the news section

user led / prototyping header

Discussions about running Android on Snowball

user led / prototyping header

Postby romang » Tue Nov 29, 2011 10:28 am

Hello. I wonder if there any code examples on how to put output on external pins from application on aroid os. Or if there any example on how to use user led on the board (GPIO_142 pin on the processor).
romang
 
Posts: 1
Joined: Fri Nov 25, 2011 7:56 am

Re: user led / prototyping header

Postby ~fgiff » Tue Dec 06, 2011 10:41 am

As with non-android Linux, you can manipulate GPIOs from userspace using sysfs, though you almost certainly will need root privileges to do so.

To toggle USR_LED for example, you can use the following commands from the serial console:

echo 142 > /sys/class/gpio/export # Export GPIO142 (USR_LED on schematic) to userspace
echo out > /sys/class/gpio/gpio142 # Set GPIO142 as an output
echo 1 > /sys/class/gpio/gpio142/value # Set GPIO142 ON (turn on USR_LED)
echo 0 > /sys/class/gpio/gpio142/value # Set GPIO142 OFF (turn off USR_LED)
~fgiff
 
Posts: 2
Joined: Tue Dec 06, 2011 10:16 am


Return to Android and Snowball

Who is online

Users browsing this forum: No registered users and 0 guests

cron