Discover: The Pi-Stop Python Module

My last PiStop workshop used a custom PiStop class which worked as follows:

#Example using PiStop.py
from pistop import *
import time
# Set PiStop in location A
with PiStop(hwSetup="A") as myPiStop:
  myPiStop.output(all,ON) #Switch all the lights ON
  time.sleep(2)
  pistop.output(G,OFF)    #Switch off the Green light

Assuming you have the pistop.py file in the same directory as your own script, you can use the above code to control any Pi-Stop in any of the standard locations.

PiStopLocationsPlus

Standard Pi-Stop locations on a Raspberry Pi Model + or Model 2

By using the Pi-Stop python module, you can place the Pi-Stop on in the correct position on the GPIO header and use it!

You don’t need to remember the pin numbers in your code, just the location you’ve used.

There are a number of built in functions available to help new users, for example to see the positions of all the available Pi-Stop locations (for your specific Raspberry Pi) you can use the showSetup() function:

# Example show setups
from pistop import *

# Will show all possible locations
PiStop.showSetup()
# Set PiStop in location A
with PiStop(hwSetup="A") as myPiStop:
  # Shall show position of location A only!

  myPiStop.showSetup()

 

The Pi-Stop python module will continue to be developed to make it as easy as possible for beginners to program using the Pi-Stop.