Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for pimoroni's pantilthat #2016

Merged
merged 2 commits into from
Aug 27, 2019

Conversation

popoviciri
Copy link
Contributor

ssh into rpi and run these to create files and set permisions:

mkdir /data/etc/python-scripts/
cat <<EOF >>/data/etc/left_1
#!/bin/bash
/usr/bin/python /data/etc/python-scripts/left.py
EOF
cat <<EOF >>/data/etc/right_1
#!/bin/bash
/usr/bin/python /data/etc/python-scripts/right.py
EOF
cat <<EOF >>/data/etc/up_1
#!/bin/bash
/usr/bin/python /data/etc/python-scripts/up.py
EOF
cat <<EOF >>/data/etc/down_1
#!/bin/bash
/usr/bin/python /data/etc/python-scripts/down.py
EOF
cat <<EOF >>/data/etc/preset1_1
#!/bin/bash
/usr/bin/python /data/etc/python-scripts/reset.py
EOF
chmod +x /data/etc/left_1 /data/etc/right_1 /data/etc/up_1 /data/etc/down_1 /data/etc/preset1_1
cat <<EOF >>/data/etc/python-scripts/left.py
#!/usr/bin/python

import time
import pantilthat

currentPos = pantilthat.get_servo_one()
newPos = currentPos +20
if newPos >= 80: newPos = 80
pantilthat.servo_one(newPos)
time.sleep(1)
EOF
cat <<EOF >>/data/etc/python-scripts/right.py
#!/usr/bin/python

import time
import pantilthat

currentPos = pantilthat.get_servo_one()
#print (currentPos)
newPos = currentPos - 20
if newPos <= -80: newPos = -80
pantilthat.servo_one(newPos)
time.sleep (1)
EOF
cat <<EOF >>/data/etc/python-scripts/up.py
#!/usr/bin/python

import time
import pantilthat

currentPos = pantilthat.get_servo_two()
#print (currentPos)
newPos = currentPos - 20
if newPos <= -80: newPos = -80
pantilthat.servo_two(newPos)
time.sleep (1)
EOF
cat <<EOF >>/data/etc/python-scripts/down.py
#!/usr/bin/python

import time
import pantilthat

currentPos = pantilthat.get_servo_two()
newPos = currentPos +20
if newPos >= 80: newPos = 80
pantilthat.servo_two(newPos)
time.sleep(1)
EOF
cat <<EOF >>/data/etc/python-scripts/reset.py
#!/usr/bin/python

import time
import pantilthat

pantilthat.servo_one(0)
pantilthat.servo_two(0)
time.sleep(1)
EOF

@ccrisan
Copy link
Collaborator

ccrisan commented Jul 27, 2019

Thanks! @popoviciri could you also please enable it for Raspberry Pi 4?

@popoviciri
Copy link
Contributor Author

Hi @ccrisan. I pushed a commit to my branch. I hope this PR gets miraculously updated as well. New to this.
Also, note the python-pantilthat will also install python-spidev.
Cheers!

@dimgod59
Copy link

excuse me the question but how to control pan tilt?
should I add UI buttons?
I can try to RPI zero :)

@ccrisan
Copy link
Collaborator

ccrisan commented Aug 27, 2019

Hi @ccrisan. I pushed a commit to my branch. I hope this PR gets miraculously updated as well. New to this.

It surely does. Thanks.

@Romancze
Copy link

Romancze commented Feb 28, 2020

Hi! How I define GPIO pins for "pantilthat.servo_one(0), pantilthat.servo_two(0)"?

@starbasessd
Copy link

starbasessd commented Feb 28, 2020 via email

@HOD42
Copy link

HOD42 commented Mar 9, 2020

How would you go about doing similar for their FanShim?

@starbasessd
Copy link

starbasessd commented Mar 9, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants