adc pi v2.2


5 posts
by zenobi » Sun Oct 27, 2013 8:47 pm
hi

i cant start with the adc pi
from www.abelectronics.co.uk/products/3/Raspberry-Pi/17/‎Vertaal deze pagina
Raspberry Pi Analogue to Digital converter, 8 Channel ADC

i have always error :
Code: Select all
Traceback (most recent call last):
  File "./adc_demo.py", line 11, in <module>
    import quick2wire.i2c as i2c
ImportError: No module named quick2wire.i2c



i dont understand step : " enable Python to access the API by adding export PYTHONPATH=$PYTHONPATH:$HOME/quick2wire-python-api to the end of ~/.profile"

where is the file ".profile" located?

Instructions

Files in the /etc directory below need to be edited as root, so use sudo nano filename

Enable I2C support
add i2c-dev to the end of /etc/modules
comment out (with a #) the line that says blacklist i2c-bcm2708 in /etc/modprobe.d/raspi-blacklist.conf
Enable the current user to access I2C hardware
install i2c-tools (includes i2cdetect and adds the i2c group) with: sudo apt-get update && sudo apt-get install i2c-tools
add the current user to the i2c group with: sudo adduser $USER i2c
Install the Quick2Wire Python API
install git with: sudo apt-get install git
download the API with: git clone https://github.com/quick2wire/quick2wire-python-api.git
enable Python to access the API by adding export PYTHONPATH=$PYTHONPATH:$HOME/quick2wire-python-api to the end of ~/.profile
Reboot to enable all the above changes
sudo reboot
Download and run the demo script
download it with: wget http://www.andrewscheller.co.uk/adc_demo.py
make it executable with: chmod +x adc_demo.py
run it with: ./adc_demo.py

If everything went well you should now find that you get:
1: 0.000000
Posts: 21
Joined: Sun Oct 27, 2013 2:19 am
Location: belgium
by joan » Sun Oct 27, 2013 8:57 pm
~ is shorthand for the home directory of the user entering the command.

e.g. if your user name is pi then ~/.profile is in /home/pi/.profile

So you could nano ~/.profile or nano /home/pi/.profile to edit the file.

Note, files starting with a . (dot) are not listed by ls by default. To see such files use ls -a
User avatar
Posts: 6558
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK
by FTrevorGowen » Sun Oct 27, 2013 9:00 pm
"~/" is shorthand for your (ie. the current user's) home directory.
If "ls -laF ~/" doesn't list a (normally hidden) file with the name ".profile" you need to create a file with that name, and add the line "export PYTHONPATH=$PYTHONPATH:$HOME/quick2wire-python-api" into it as per the instructions eg. with nano like @joan suggested whilst I was typing this.
(NB: I don't use an "adc pi" myself, but have inferred the above from the info. you provided)
Trev.
Mainly running "Wheezy Raspbian" on seven Pi's (an A, B1, 2xB2, 2xB+ and an A+). Notes about them begin at http://www.cpmspectrepi.webspace.virginmedia.com/raspberry_pi/raspiidx.htm
User avatar
Forum Moderator
Forum Moderator
Posts: 2033
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
by zenobi » Mon Oct 28, 2013 9:39 am
if i look in the folders i have something like : /home/pi/quick2wire-python-api

do i have to change also the text within te .profile?

or is "$HOME/quick2wire-python-api" the same as : /home/pi/quick2wire-python-api ?


THX
Posts: 21
Joined: Sun Oct 27, 2013 2:19 am
Location: belgium
by joan » Mon Oct 28, 2013 11:52 am
zenobi wrote:if i look in the folders i have something like : /home/pi/quick2wire-python-api

do i have to change also the text within te .profile?

or is "$HOME/quick2wire-python-api" the same as : /home/pi/quick2wire-python-api ?


THX

They should be the same. Something wrong if they are not.

Type

echo $HOME

from the command line to check.
User avatar
Posts: 6558
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK