Memorial day is 05/25/2015 – Orders will ship out on May 26th. There will not be any deliveries or shipping on Monday. Any order placed after 11am ET on Friday May 22nd will not start to ship out until Tuesday May 26th.

tutorials/software
Moderators: adafruit_support_bill, adafruit

Forum rules
Get help, and assist others in with open source kits and running a business! Do not ask for legal advice or for consulting services in this forum, only general biz questions!

tutorials/software

by rcomeau on Fri Dec 07, 2012 7:22 pm

Just a few things that I have found over the last few days that may help make your products easier for people to use.

1. Change'Adafruit_i2c.py' to take a 1 or 0 for the i2c driver so that smbus is not needed in externial code:
Original:
def __init__(self, address, bus=smbus.SMBus(0), debug=False):
self.address = address
self.bus = bus
self.debug = debug
2. New:
def __init__(self, address, bus=1, debug=False): # rev 2
self.address = address
self.bus =smbus.SMBus(bus)
self.debug = debug

3. Servo demo:
a. You say in the tutorial that if you have rev 2 boards, that you must change:
self.i2c = Adafruit_I2C(address)
to 
self.i2c = Adafruit_I2C(address, bus=smbus.SMBus(1))

In order for the tutorial to work 'import smbus' must also be added to the
 Adafruit_PWM_Servo_Driver/Adafruit_PWM_Servo_Driver.py
Should be modified as per 1. above

b. ^C should shut down the demo, not leave it running! Haven't dug into the code yet.
4. I2c.py:
a. Adafruit_I2C.py file should be the same in:
/Adafruit-Raspberry-Pi-Python-Code/Adafruit_I2C
as in:
/Adafruit-Raspberry-Pi-Python-Code/Adafruit_BMP085(and elsewhere, and it's not!)
should use the same base file.


Seriously screws up the tabs!!!!!

rcomeau
 
Posts: 4
Joined: Tue Jun 19, 2012 11:37 am

Re: tutorials/software

by adafruit_support_bill on Sat Dec 08, 2012 7:48 am

Thanks for the feedback! We are always trying to improve.
The best way to ensure this gets onto the author's to-do list is to post it in the comments & corrections link on the left of the tutorial page.

adafruit_support_bill
 
Posts: 37521
Joined: Sat Feb 07, 2009 10:11 am

Re: tutorials/software

by adafruit on Sat Dec 08, 2012 3:50 pm

we're updating the i2c sublibrary to auto-detect rev 1 or rev 2 shortly -

adafruit
 
Posts: 11905
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc