Help get this topic noticed by sharing it on Twitter, Facebook, or email.
I have forwarded your question on to our Book Tech staff, so they can help you find a solution. If you ever have any questions or issues with the content of a title, you can also contact them directly at firstname.lastname@example.org or call them at:
1-707-827-7019 (outside the USA)
7:30 am to 5:00 PST
TY Chris for the fast reply, this is the latise error I'm getting:
Traceback (most recent call last):
File "adc_test.py", line 12, in
reading = analog_read(0)
File "adc_test.py", line 7, in analog_read
r = spi.xfer2([1, (8 + channel) << 4, 0])
IOError: [Errno 9] Bad file descriptor
I copied program off the web. Other programs run ok?
It's looks almost like the file spi.open(0, 0) is missing, from another error I was getting. Strange!
Sorry for the delay in responding.
That still doesn't seem like the full error message, but I'll take a shot at this...
"It's looks almost like the file spi.open(0, 0) is missing, from another error I was getting. Strange!"
Make sure you have followed the directions on the top of that page 309, where it says:
Before trying the program, make sure you have SPI enabled and the SPI Python library installed (Recipe 8.6).
If that isn't the cause of the problem, please include the complete error message that you are getting whey you run the program.
O'Reilly Book Support