RPi Gpio update.

 
Found some of the commands on the Raspberry Pi changed a little bit The Raspberry Pi per se does not have analog ports like the Arduino. though you can get converters that can be attached to the gpio or use an r2r setup. To light an led, you will need to use at least two pins. A gpio and a ground pin. You will also need an led and an appropriate resistor. Once you master these simple steps you can additional electronics and control quite a few things. Remember the gpio only uses very low voltage. Additional safety circuitry is needed for other projects.
Note: you can use jumper wires from  older computers if you do not need to use the whole header.


old version
-----------

 # Turn light on cd

/sys/class/gpio

# Turn on pin but defaults to low.

echo 17 > export

# Set port direction, in this case we are doing output.

echo out > gpio17/direction

# Set pin high and turn on led.

echo 1 > gpio17/value

#Turn light off

echo 0 > gpio17/value



New version of bash gpio: You have to use the full path with commands.

# Turn light on
 


cd /sys/class/gpio
 

# Turn on pin but defaults to low.
 

echo "17" > /sys/class/gpio/export
 

# Set port direction in this case we are doing output.
 

echo "out" > /sys/class/gpio/gpio17/direction
 

# Set pin high and turn on led.
 

echo "1" > /sys/class/gpio/gpio17/value
 

#Turn light off
 

echo "0" > /sys/class/gpio/gpio17/value

  Screenshot from 2013-09-27 04:41:18

Comments

Popular posts from this blog

Guiless?

MSOffice vs Libreoffice

Raspberry pi zero.