Quantcast
Channel: Intel Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 41305

Toggling Arduino Pins from Linux

$
0
0

I want to toggle one of the Arduino header pins from within Linux. I have followed Sergey's example from his blog.

http://www.malinov.com/Home/sergey-s-blog/intelgalileo-programminggpiofromlinux

 

I picked Digital Pin 4 (D4) because it is one of the pins that is not muxed, which should make it simpler.

 

I used the below Linux commands to try light an LED connected to Pin D4, but nothing happens. Am I doing something wrong? Did I miss a step?

 

#To Turn the Port On

echo -n "28" > /sys/class/gpio/export

 

#to Turn the Port as in Output

echo -n "out" > /sys/class/gpio/gpio28/direction

 

#turn on the pin

echo -n "1" > /sys/class/gpio/gpio28/value

 

 

 

Here is the output from my testing:

root@clanton:~# #To Turn the Port On

root@clanton:~# echo -n "28" > /sys/class/gpio/export

root@clanton:~#

root@clanton:~# #to Turn the Port as in Output

root@clanton:~# echo -n "out" > /sys/class/gpio/gpio28/direction

root@clanton:~# more /sys/class/gpio/gpio28/direction

out

root@clanton:~#

root@clanton:~# #turn on the pin

root@clanton:~# echo -n "1" > /sys/class/gpio/gpio28/value

root@clanton:~# more /sys/class/gpio/gpio28/value

1

 


Viewing all articles
Browse latest Browse all 41305

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>