Changes

Jump to navigation Jump to search
Line 109: Line 109:  
====Raspberry Pi GPIO Pins====
 
====Raspberry Pi GPIO Pins====
 
This was the original way the pins where connected to the encoders and it is still supported in the Zynthian. The Broadcom Addresses are put into the appropriate box to link the encoder to the zynth.
 
This was the original way the pins where connected to the encoders and it is still supported in the Zynthian. The Broadcom Addresses are put into the appropriate box to link the encoder to the zynth.
 +
 +
There is a fairly involved explanation as to why the numbers end up they way they are and not simply the number of the pin on the Raspberry Pi connector.
 +
There are two ways of addressing GPIO pins on a Pi.
 +
 +
The code illustrates the issue
 +
 +
RPi.GPIO supports referring to GPIO pins using either the physical pin numbers on the GPIO connector or using the BCM channel names from the Broadcom SOC that the pins are connected to. For example, pin 24 is BCM channel GPIO8. To use physical board pin numbers, call:
 +
 +
GPIO.setmode(GPIO.BOARD)
 +
 +
and to use the BCM channel numbers, use:
 +
 +
GPIO.setmode(GPIO.BCM)
 +
 +
Either method will work. The BOARD number scheme has the advantage that the library is aware of the Raspberry Pi model it is running on and will work correctly even if the Broadcom SOC channel names change in the future.
 +
 +
In the zynth we use GPIO.setmode(GPIO.BCM)
 +
and this is as it is so you ned to use GPIO references NOT Raspberry Pi Pin numbers.
 +
 
====I2C====
 
====I2C====
  
1,019

edits

Navigation menu