Advertisement
Guest User

gpiopins.sh

a guest
Feb 20th, 2013
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.29 KB | None | 0 0
  1. #!/usr/bin/python
  2. import RPi.GPIO as GPIO
  3.  
  4. #Detect and display board information
  5. #If additional changes are made beyond Rev2,
  6. #this code will need to be updated.
  7. print "Meltwater's Pi Hardware - GPIO Info"
  8. print "Board Revision: " + str(GPIO.RPI_REVISION)
  9. if (GPIO.RPI_REVISION > 2):
  10.   print "Warning: New Revision detected check for new pinouts."
  11. print "P1:"
  12. print " 3V3     1 2      5V"
  13.  
  14. #Select board revision here to allow for pins 3 & 5 update
  15. if (GPIO.RPI_REVISION == 1):
  16.  print " SDA0    3 4      5V"
  17.  print " SCL0    5 6     Gnd"
  18. else:
  19.  print " SDA1    3 4      5V"
  20.  print " SCL1    5 6     Gnd"
  21.  
  22. print " GPIO04  7 8      Tx"
  23. print " Gnd     9 10     Rx"
  24. print " GPIO17 11 12 GPIO18"
  25.  
  26. #Select board revision here to allow for pin 13 update
  27. if (GPIO.RPI_REVISION == 1):
  28.  print " GPIO21 13 14    Gnd"
  29. else:
  30.  print " GPIO27 13 14    Gnd"
  31.  
  32. print " GPIO22 15 16 GPIO23"
  33. print " 3V3    17 18 GPIO24"
  34. print " MOSI   19 20    Gnd"
  35. print " MISO   21 22 GPIO25"
  36. print " SCLK   23 24    CE0"
  37. print " Gnd    25 26    CE1"
  38.  
  39. #Select board revision here for Rev2's new P5 header
  40. # (as viewed from topside)
  41. if (GPIO.RPI_REVISION != 1):
  42.  print ""
  43.  print "P5:"
  44.  print " 3V3     2 1      5V"
  45.  print " SCL0    4 3    SDA0"
  46.  print " GPIO31  6 5  GPIO30"
  47.  print " Gnd     8 7     Gnd"
  48.  
  49. #End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement