rasathus / circadianLighting

A simple circadian lighting implementation using a Raspberry Pi, some Adafruit RGB leds and the Raphael.js colour picker demos.
MIT License
15 stars 4 forks source link

starting simple - with the ws2801 example in pigredients >> cannot import module spidev #3

Closed t3kboi closed 11 years ago

t3kboi commented 11 years ago

You circadian color picker has beat me to the punch on a project I am working on, so I am trying to get it working, so I can use it as a base.

But --

When I call app.py - it fails at the import ws2801 from pigredients.ics as ws2801

If I trace all the way back to the ws2801.py example in pigredients, it fails on line 1: import spidev

" File "/usr/local/lib/python2.7/dist-packages/pigredients-0.5-py2.7.egg/pigredients/ics/ws2801.py", line 1, in import spidev ImportError: No module named spidev"

I am a total noob - but I cant seem to figure out how to proceed.

spidev is installed, and I can access it from a C program, and the /dev contains spidev0.0 and spidev0.1

I can successfully use PixelPi, and Adafruit_LED_Pixels (which also use spidev).

I just cant use the examples that call pigredients....

Any ideas?

rasathus commented 11 years ago

Did you checkout py-spidev from here ? https://github.com/doceme/py-spidev

By the looks of the Adafruit implementation its doing file writes to the '/dev/spidev0.0' device. def writestrip(pixels): spidev = file("/dev/spidev0.0", "w") I couldnt see any imports for spidev in either Adafruit or PixelPi's code.

I would suggest doing a clone of the py-spidev repository, then running the setup.py included. I think this should resolve the issue you're seeing.

t3kboi commented 11 years ago

Thanks for the quick response!

I actually just found that on my own – I am so new to this that I am unable to differentiate what is part of python, versus what is part of linux…..

I was just using my droid to change the colors on my leds…..

Quick question - point me on the right path…

I’d the color picker code to specify a specific pixel or group of pixels. (i.e select pixel 4, or pixels 6-11) and then set the color and apply with a button.

So rather than updating on the onChange event, moving it to the OnButtonClick event.

Where should I look to figure out how to address individual pixels?

Thanks,

From: Rasathus [mailto:notifications@github.com] Sent: Thursday, February 21, 2013 3:58 PM To: rasathus/circadianLighting Cc: t3kboi Subject: Re: [circadianLighting] starting simple - with the ws2801 example in pigredients >> cannot import module spidev (#3)

Did you checkout py-spidev from here ? https://github.com/doceme/py-spidev

By the looks of the Adafruit implementation its doing file writes to the '/dev/spidev0.0' device. def writestrip(pixels): spidev = file("/dev/spidev0.0", "w") I couldnt see any imports for spidev in either Adafruit or PixelPi's code.

I would suggest doing a clone of the py-spidev repository, then running the setup.py included. I think this should resolve the issue you're seeing.

— Reply to this email directly or view it on GitHub https://github.com/rasathus/circadianLighting/issues/3#issuecomment-13918500 .

https://github.com/notifications/beacon/4_jLz8Mw4MHBRcnYJGtz73Bav6o7rbSQC_JCoJZl43-F5aYkWBhHlS2zpmAjkLd8.gif

rasathus commented 11 years ago

Its not currently exposed via the web front end, you'd need to add a request hook into app.py. And then rather than calling 'self.led_chain.set_rgb([255,255,255])' you could call 'self.led_chain.set_ic(ic_id, [255,255,255[)'.

You would need to bypass the transitions stuff for now, as that only supports state changes for entire strings. I've been looking into implementing it to allow some more interesting transitions.

Ill add it as a feature 'issue'.

t3kboi commented 11 years ago

Thanks!

From: Rasathus [mailto:notifications@github.com] Sent: Thursday, February 21, 2013 4:23 PM To: rasathus/circadianLighting Cc: t3kboi Subject: Re: [circadianLighting] starting simple - with the ws2801 example in pigredients >> cannot import module spidev (#3)

Its not currently exposed via the web front end, you'd need to add a request hook into app.py. And then rather than calling 'self.led_chain.set_rgb([255,255,255])' you could call 'self.led_chain.set_ic(ic_id, [255,255,255[)'.

You would need to bypass the transitions stuff for now, as that only supports state changes for entire strings. I've been looking into implementing it to allow some more interesting transitions.

Ill add it as a feature 'issue'.

— Reply to this email directly or view it on GitHub https://github.com/rasathus/circadianLighting/issues/3#issuecomment-13919593 .

https://github.com/notifications/beacon/4_jLz8Mw4MHBRcnYJGtz73Bav6o7rbSQC_JCoJZl43-F5aYkWBhHlS2zpmAjkLd8.gif