zenobi
Posts: 21
Joined: Sun Oct 27, 2013 2:19 am
Location: belgium

adc pi v2.2

Sun Oct 27, 2013 8:47 pm

hi

i cant start with the adc pi
from www.abelectronics.co.uk/products/3/Rasp ... 7/‎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

User avatar
joan
Posts: 12746
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: adc pi v2.2

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
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 4075
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: adc pi v2.2

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.
Usually running Raspbian Jessie on up to 12 of 13 Pi's (an A, B1, 2xB2, 2xB+, A+, P2B, 3xP0, P0W) and Stretch on my P3B. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

zenobi
Posts: 21
Joined: Sun Oct 27, 2013 2:19 am
Location: belgium

Re: adc pi v2.2

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

User avatar
joan
Posts: 12746
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: adc pi v2.2

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.

Return to “Troubleshooting”

Who is online

Users browsing this forum: mi7chy and 41 guests