Page 1 of 1

RPi Adafruit 16x2 LCD Internet Radio - Python Script error

Posted: Tue Sep 01, 2015 10:50 am
by hp1975
Hello All,

I've been tinkering with the Pi and scouring the net for hours trying to solve this and I'm stumped so I've come here hopefully for some assistance (

I'm trying to build an internet radio following this guide http://www.instructables.com/id/Raspber ... /?ALLSTEPS

It was all going ok until i tried to actually get the Radio scripts to work with the LCD.

I know that I2C is working because the example .py script that cycles colours on the screen and lets you test the buttons works fine.
I know that MPD and MPC work because I can get a stream to play if I run it direct from the command line.

BUT when I run what I assume is the main radio script 'radio.py' I get this error:

Code: Select all

pi@raspberrypi ~/radio $ sudo python radio.py
['mpc', 'stop']
mpc stop --> ['volume:100%   repeat: off   random: off   single: off   consume: off']
Traceback (most recent call last):
  File "radio.py", line 385, in <module>
    Radio().run()
  File "radio.py", line 267, in __init__
    Adafruit_CharLCDPlate(),
  File "/home/pi/radio/Adafruit_CharLCDPlate.py", line 81, in __init__
    self.i2c = Adafruit_I2C(addr, busnum, debug)
  File "/home/pi/radio/Adafruit_I2C.py", line 36, in __init__
    busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber())
IOError: [Errno 2] No such file or directory
Googling around, popular opinion seems to be that this is a problem with the I2C not being enabled, but as the example script works fine I can only assume its something else. I have no experience of Python and so I'm struggling with deciphering this error.

I'd really appreciate some help with this, as I bet there are loads of folks that have had a crack at this project!

Cheers

Re: RPi Adafruit 16x2 LCD Internet Radio - Python Script err

Posted: Tue Sep 01, 2015 11:52 pm
by DougieLawson
sudo raspi-config
That program (it's a shell script) has an option to enable I2C.

Re: RPi Adafruit 16x2 LCD Internet Radio Python Script [sol

Posted: Wed Sep 02, 2015 11:26 am
by hp1975
Thanks Dougie but I solved this. The I2C was always enabled because the adafruit lcd test script worked. I discovered that the copy of the Adafruit_I2C.py file I was using was three years old. I grabbed the latest from the Adafruit github repo and everything works like a charm.