Scriptlets to control speed
parent
2aae8f5b58
commit
af0712316c
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# mp101-pi-fast
|
||||
#
|
||||
# Copyright (C) 2023, Jeff Moe
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import RPi.GPIO as GPIO
|
||||
import time
|
||||
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
|
||||
GPIO.setup(12, GPIO.OUT) # XXX PWM Direction
|
||||
|
||||
# Set PWM instance and their frequency
|
||||
pwm12 = GPIO.PWM(12, 1.00)
|
||||
|
||||
# Start PWM with 100% Duty Cycle
|
||||
pwm12.start(100)
|
||||
|
||||
input('Press return to stop:') #Wait
|
||||
|
||||
# Stops the PWM
|
||||
pwm12.stop()
|
||||
|
||||
# Cleans the GPIO
|
||||
GPIO.cleanup()
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# mp101-pi-fast
|
||||
#
|
||||
# Copyright (C) 2023, Jeff Moe
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import RPi.GPIO as GPIO
|
||||
import time
|
||||
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
|
||||
GPIO.setup(12, GPIO.OUT) # XXX PWM Direction
|
||||
|
||||
# Set PWM instance and their frequency
|
||||
pwm12 = GPIO.PWM(12, 1)
|
||||
|
||||
# Start PWM with 100% Duty Cycle
|
||||
pwm12.start(50)
|
||||
|
||||
input('Press return to stop:') #Wait
|
||||
|
||||
# Stops the PWM
|
||||
pwm12.stop()
|
||||
|
||||
# Cleans the GPIO
|
||||
GPIO.cleanup()
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# mp101-pi-slow
|
||||
#
|
||||
# Copyright (C) 2023, Jeff Moe
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import RPi.GPIO as GPIO
|
||||
import time
|
||||
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
|
||||
GPIO.setup(12, GPIO.OUT) # XXX PWM Direction
|
||||
|
||||
# Set PWM instance and their frequency
|
||||
pwm12 = GPIO.PWM(12, 0.5)
|
||||
|
||||
# Start PWM with 0% Duty Cycle
|
||||
pwm12.start(0)
|
||||
|
||||
input('Press return to stop:') #Wait
|
||||
|
||||
# Stops the PWM
|
||||
pwm12.stop()
|
||||
|
||||
# Cleans the GPIO
|
||||
GPIO.cleanup()
|
||||
|
Loading…
Reference in New Issue