Comments (2)
The RPi.GPIO actually does auto detect the Raspberry Pi revision. By switching to BOARD pin addressing instead of BCM, the code works ok on both the Rev 1 and Rev 2 Pi's.
diff --git a/Adafruit_CharLCD/Adafruit_CharLCD.py b/Adafruit_CharLCD/Adafruit_CharLCD.py index bbb8955..aef9556 100755 --- a/Adafruit_CharLCD/Adafruit_CharLCD.py +++ b/Adafruit_CharLCD/Adafruit_CharLCD.py @@ -54,17 +54,21 @@ class Adafruit_CharLCD: - def __init__(self, pin_rs=25, pin_e=24, pins_db=[23, 17, 21, 22], GPIO = None): + #def __init__(self, pin_rs=25, pin_e=24, pins_db=[23, 17, 27, 22], GPIO = None): + def __init__(self, pin_rs=22, pin_e=18, pins_db=[16, 11, 13, 15], GPIO = None): + # Emulate the old behavior of using RPi.GPIO if we haven't been given # an explicit GPIO interface to use if not GPIO: import RPi.GPIO as GPIO self.GPIO = GPIO + self.GPIO.setwarnings(False) self.pin_rs = pin_rs self.pin_e = pin_e self.pins_db = pins_db - self.GPIO.setmode(GPIO.BCM) + self.GPIO.setmode(GPIO.BOARD) + #self.GPIO.setmode(GPIO.BCM) self.GPIO.setup(self.pin_e, GPIO.OUT) self.GPIO.setup(self.pin_rs, GPIO.OUT)
from adafruit-raspberry-pi-python-code.
we added a note to the tutorial and the code about the pin change - the cobbler has BCM pinout so we want to keep it with BCM :)
from adafruit-raspberry-pi-python-code.
Related Issues (20)
- PWM Servo Driver not running my servos HOT 1
- Adafruit_DHT binary needs updating with RPi 2 Base address HOT 1
- adafruit_charLCD/RPI.GPIO RuntimeError: No access to /dev/mem. Try running as root! HOT 1
- ws2801 needs update/test with py3 HOT 1
- patch for Adafruit_MCP230xx/Adafruit_MCP230xx.py HOT 2
- MCP4725 "Error accessing ...: Check your I2C address" HOT 1
- A package for Adafruit-Raspberry-Pi-Python-Code HOT 18
- Continuous integration and PEP8 HOT 1
- Enhancement - writeRowSane() HOT 2
- Hardcoded reference to 0x70 address HOT 1
- Is it possible to send data to WS2812 Light strip through the Servo Hat HOT 1
- LCD over I2C display on HOT 1
- <Deleted>
- lots of tutorials point to this repo HOT 3
- Unable to install many of the new python modules using python3 HOT 3
- Lines never reached HOT 1
- Send data BMP180 between client and server trought module socket HOT 1
- Solution for long cable on DHT22/11 HOT 6
- Port Code to .Net
- Rust HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adafruit-raspberry-pi-python-code.