I have my pi hooked up to a shaking device, and I'm looking to drive it at relatively low frequencies. My code looks like this:
# Import the necessary header modules
import RPi.GPIO as GPIO
from time import sleep
## Setup the GPIO for PWM on pin12 {GPIO18}
Hz = 1
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.OUT)
p = GPIO.PWM(12, Hz)
p.start(50)
raw_input("Press Enter key to Stop")
GPIO.cleanup()
But when I tested it out at 1 Hz, the frequency that was coming out of the shaker was too quick (I'd say closer to 2 Hz). I'm only testing it by ear, so can't really test it at higher frequency, but I'm confident I can discern a 1 Hz beat, and the Pi seems to be putting out a beat that is too quick. Any thoughts on how to fix this?