RPi: Difference between revisions

From SoftwareGuy
Jump to navigation Jump to search
Mark (talk | contribs)
No edit summary
Mark (talk | contribs)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Setup as output
=== Setup as output ===


  echo "23" > /sys/class/gpio/export
  echo "23" > /sys/class/gpio/export
Line 7: Line 7:
  echo "0" > /sys/class/gpio/gpio23/value
  echo "0" > /sys/class/gpio/gpio23/value


Setup as input
=== Setup as input ===


  echo "23" > /sys/class/gpio/export
  echo "23" > /sys/class/gpio/export
Line 22: Line 22:
  gpio -g write 23 0
  gpio -g write 23 0


Network interface with multiple IP's
=== Network interface with multiple IP's ===


/etc/network/interfaces
/etc/network/interfaces
Line 30: Line 30:
  iface lo inet loopback
  iface lo inet loopback
  auto eth0
  auto eth0
  iface eth0 inet dhcp
  iface eth0 inet dhcp
   
   
  auto eth0:0  
  auto eth0:0
  iface eth0:0 inet dhcp
  iface eth0:0 inet static  
auto eth0:1
iface eth0:1 inet static  
       address 192.168.1.42  
       address 192.168.1.42  
       netmask 255.255.255.0
       netmask 255.255.255.0
Line 45: Line 41:
  wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
  wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
  iface default inet dhcp
  iface default inet dhcp
=== Crontab ===
@reboot /home/pi/projects/orca/orca.sh > orca.log 2>&1

Latest revision as of 15:41, 9 May 2024

Setup as output[edit | edit source]

echo "23" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio23/direction
echo "1" > /sys/class/gpio/gpio23/value
echo "0" > /sys/class/gpio/gpio23/value

Setup as input[edit | edit source]

echo "23" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio23/direction
cat /sys/class/gpio/gpio23/value
echo "23" > /sys/class/gpio/unexport

Or:

gpio -g mode 23 out
gpio -g write 23 1
gpio -g write 23 0

Network interface with multiple IP's[edit | edit source]

/etc/network/interfaces

auto lo

iface lo inet loopback
auto eth0
iface eth0 inet dhcp

auto eth0:0
iface eth0:0 inet static 
      address 192.168.1.42 
      netmask 255.255.255.0

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Crontab[edit | edit source]

@reboot /home/pi/projects/orca/orca.sh > orca.log 2>&1