Raspberry Pi library for working with the Amperka Octofet – 8-channels switch board.
Raspberry Pi library to interface with the Amperka Octofet 8-channel power switches.
If you haven’t enabled SPI support in your Raspbian Linux yet, open the terminal and run the following commands:
- Use the down arrow to select
5 Interfacing Options.
- Arrow down to
<Yes>when it asks you to enable SPI.
<Ok>when it tells you that SPI is enabled.
- Use the right arrow to select the
- Reboot your Raspberry Pi to make the SPI interface appear.
After reboot, log in and enter the following command:
$ ls /dev/spi*
The Pi should respond with:
These represent SPI devices on chip enable pins 0 and 1, respectively. These pins are hardwired within the Pi.
pip to install the library:
pip3 install octofet
import time import octofet # Create an Octofet object connected to the CE0 pin of the Raspberry Pi board. octo = octofet.Octofet(0) # Switch state variable. state = True while True: # For each switch. for switch in range(8): # Set the current state for the switch. octo.digital_write(switch, state) # Wait 1 second. time.sleep(1) # Toogle state. state = not state
See full API reference in API.md.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
octofet-1.0.0.tar.gz (15.6 kB view hashes)