Re: project 001 servo multiway controller
Posted: Wed Aug 26, 2015 7:34 pm
A small, affordable computer with free resources to help people learn, make things, and have fun
https://www.raspberrypi.org/forums/
https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=114691
We (and the arduino forumites) want to help you to learn how to do this, not to do all the work for you. So we post suggestions and guidelines and if you post your code we will give advice on that.davezx wrote:I've been looking on Google a lot.
There are some threads which people have asked for help for the same as what I'm wanting to do but when they ask for help all the answers just confuse the person asking the question.
The closest one I've found was on the arduino forum which a bloke wants a program to
Move a device from A-B and stay there.
Be able to stop/pause mid travel
Adjust forward/backward mid travel.
Use end limit switches at either side.
Use push buttons.
He's got some advice but the thread doesn't go to completion of project to see if it worked or not.
Surely it would be better if someone had a script to make this work it would be better to post it so it can be copied/typed up rather than having the bloke tearing his hair out trying to work How to write it.
Code: Select all
Please try to find your own solution before reading
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
input_state = GPIO.input(18)
if input_state == False:
print('Button Pressed')
time.sleep(0.2)
GPIO.cleanup()
Code: Select all
Please try to find your own solution before reading
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
while (True):
GPIO.output(18, True)
time.sleep(0.5)
GPIO.output(18, False)
time.sleep(0.5)Code: Select all
Please try to find your own solution before reading
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
GPIO.output(18, True)
time.sleep(0.5)
GPIO.output(18, False)
GPIO.cleanup()
Code: Select all
Please try to find your own solution before reading
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(17, GPIO.OUT)
while True:
input_state = GPIO.input(18)
if input_state == False:
print('Button Pressed')
GPIO.output(17, True)
time.sleep(10)
GPIO.output(17, False)
GPIO.cleanup()