1
0
Fork 0

Left, right, up, down scriptlets for Pi

main
Jeff Moe 2023-03-25 18:11:18 -06:00
parent 06ba5962ac
commit 549a22351b
5 changed files with 149 additions and 4 deletions

36
pi/mp101-pi-down 100755
View File

@ -0,0 +1,36 @@
#!/usr/bin/env python3
#
# mp101-pi-down
#
# 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)
print("setup")
GPIO.setup(6, GPIO.OUT) # Pin 31 GPIO6 Left
GPIO.setup(17, GPIO.OUT) # Pin 11 GPIO17 Down
GPIO.setup(16, GPIO.OUT) # Pin 36 GPIO16 Up
GPIO.setup(5, GPIO.OUT) # Pin 29 GPIO5 Right
#GPIO.setup(32, GPIO.OUT) # XXX PWM Direction
#GPIO.setup(2, GPIO.OUT) # Pin 2 5V XXX
print("Down GPIO 17")
GPIO.output(17, GPIO.HIGH)
time.sleep(3)
GPIO.output(17, GPIO.LOW)

37
pi/mp101-pi-left 100755
View File

@ -0,0 +1,37 @@
#!/usr/bin/env python3
#
# mp101-pi-left
#
# 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)
print("setup")
GPIO.setup(6, GPIO.OUT) # Pin 31 GPIO6 Left
GPIO.setup(17, GPIO.OUT) # Pin 11 GPIO17 Down
GPIO.setup(16, GPIO.OUT) # Pin 36 GPIO16 Up
GPIO.setup(5, GPIO.OUT) # Pin 29 GPIO5 Right
#GPIO.setup(32, GPIO.OUT) # XXX PWM Direction
#GPIO.setup(2, GPIO.OUT) # Pin 2 5V XXX
print("Left GPIO 6")
GPIO.output(6, GPIO.HIGH)
time.sleep(1)
GPIO.output(6, GPIO.LOW)

36
pi/mp101-pi-right 100755
View File

@ -0,0 +1,36 @@
#!/usr/bin/env python3
#
# mp101-pi-right
#
# 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)
print("setup")
GPIO.setup(6, GPIO.OUT) # Pin 31 GPIO6 Left
GPIO.setup(17, GPIO.OUT) # Pin 11 GPIO17 Down
GPIO.setup(16, GPIO.OUT) # Pin 36 GPIO16 Up
GPIO.setup(5, GPIO.OUT) # Pin 29 GPIO5 Right
#GPIO.setup(32, GPIO.OUT) # XXX PWM Direction
#GPIO.setup(2, GPIO.OUT) # Pin 2 5V XXX
print("Right GPIO 5")
GPIO.output(5, GPIO.HIGH)
time.sleep(1)
GPIO.output(5, GPIO.LOW)

View File

@ -42,21 +42,21 @@ time.sleep(1)
print("Right GPIO 5")
GPIO.output(5, GPIO.HIGH)
time.sleep(2)
time.sleep(5)
GPIO.output(5, GPIO.LOW)
print("Left GPIO 6")
GPIO.output(6, GPIO.HIGH)
time.sleep(2)
time.sleep(5)
GPIO.output(6, GPIO.LOW)
print("Up GPIO 16")
GPIO.output(16, GPIO.HIGH)
time.sleep(2)
time.sleep(3)
GPIO.output(16, GPIO.LOW)
print("Down GPIO 17")
GPIO.output(17, GPIO.HIGH)
time.sleep(2)
time.sleep(3)
GPIO.output(17, GPIO.LOW)

36
pi/mp101-pi-up 100755
View File

@ -0,0 +1,36 @@
#!/usr/bin/env python3
#
# mp101-pi-up
#
# 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)
print("setup")
GPIO.setup(6, GPIO.OUT) # Pin 31 GPIO6 Left
GPIO.setup(17, GPIO.OUT) # Pin 11 GPIO17 Down
GPIO.setup(16, GPIO.OUT) # Pin 36 GPIO16 Up
GPIO.setup(5, GPIO.OUT) # Pin 29 GPIO5 Right
#GPIO.setup(32, GPIO.OUT) # XXX PWM Direction
#GPIO.setup(2, GPIO.OUT) # Pin 2 5V XXX
print("Up GPIO 16")
GPIO.output(16, GPIO.HIGH)
time.sleep(3)
GPIO.output(16, GPIO.LOW)