harenome / piglow_spark

PiGlow Spark

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PiGlow Spark

PiGlow Spark is a Python module for the PiGlow addon by Pimoroni.

This was originally a fork of Ben Lebherz's PyGlow which itself is a fork of Jason Barnett's PiGlow.

Quick How To

Preparation of the system

These steps will allow your system to be aware of the PiGlow and to be able communicate with it.

Install the i2c libraries and python support

$ sudo apt-get install python-smbus

Enable the i2c driver modules

If not present, append these lines to the /etc/modules file:

i2c-dev
i2c-bcm2708

Also check that the driver modules are not blacklisted in the /etc/modprobe.d/raspi-blacklist.conf file. You can either delete or comment (insert a # at the beginning of the line) these lines if they exist:

# blacklist spi-bcm2708
# blacklist i2c-bcm2708

Get the rights

By default, only root is allowed to access i2c devices. The following lines will create (if it does not already exist) the group i2c and allow it to access i2c devices:

$ groupadd i2c
$ echo 'KERNEL=="i2c-[0-9]*", GROUP="i2c"' >> /etc/udev/rules.d/10-local.rules

Once the i2c group exists, add users to the group:

$ usermod -aG i2c <username>

Reboot

Once you have completed the steps above, restart your Raspberry Pi.

$ sudo reboot

Interactive mode

Enter interactive mode:

$ ./interactive.py

Example

$ ./example.py

Credits

  • Jason Barnett (@Boeeerb on Github and @boeeerb on Twitter) for his PiGlow module.
  • Ben Lebherz (@benleb on Github and @ben_leb on Twitter) for his PyGlow module.
  • Those who contributed to the aforementioned modules.

License

CC_BY_NC_SA_IMG

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.

About

PiGlow Spark


Languages

Language:Python 100.0%