Hallo Zusammen,
ich habe mir das adafruit-dc-stepper-motor-hat-
http://www.adafruit.com/product/2348
für den raspberry-pi-2 geholt.
Die Test dateil läuft auch soweit --
die Beispiel Datei -->DCTest.Py
#!/usr/bin/python
from Adafruit_MotorHAT import Adafruit_MotorHAT, Adafruit_DCMotor
import time
import atexit
# create a default object, no changes to I2C address or frequency
mh = Adafruit_MotorHAT(addr=0x60)
# recommended for auto-disabling motors on shutdown!
def turnOffMotors():
mh.getMotor(1).run(Adafruit_MotorHAT.RELEASE)
mh.getMotor(2).run(Adafruit_MotorHAT.RELEASE)
mh.getMotor(3).run(Adafruit_MotorHAT.RELEASE)
mh.getMotor(4).run(Adafruit_MotorHAT.RELEASE)
atexit.register(turnOffMotors)
################################# DC motor test!
myMotor = mh.getMotor(3)
# set the speed to start, from 0 (off) to 255 (max speed)
myMotor.setSpeed(150)
myMotor.run(Adafruit_MotorHAT.FORWARD);
# turn on motor
myMotor.run(Adafruit_MotorHAT.RELEASE);
while (True):
print "Forward! "
myMotor.run(Adafruit_MotorHAT.FORWARD)
print "\tSpeed up..."
for i in range(255):
myMotor.setSpeed(i)
time.sleep(0.01)
print "\tSlow down..."
for i in reversed(range(255)):
myMotor.setSpeed(i)
time.sleep(0.01)
print "Backward! "
myMotor.run(Adafruit_MotorHAT.BACKWARD)
print "\tSpeed up..."
for i in range(255):
myMotor.setSpeed(i)
time.sleep(0.01)
print "\tSlow down..."
for i in reversed(range(255)):
myMotor.setSpeed(i)
time.sleep(0.01)
print "Release"
myMotor.run(Adafruit_MotorHAT.RELEASE)
time.sleep(1.0)
der motor beschleinigt nur kurz (bremst wieder ab und wechselt die richtung beschleunigt wieder kurz bremst ab und wechselt die richtung und das im loop
Wie kann ich programmieren bzw mit welchem befehl funktioniert es das der Motor eine bestimmte zeit lang(also sekunden die ich eingeben kann )eingeschalten bleibt.
Bin absoluter anfänger und arbeite mich gerade erst ein..wäre super wenn mir jemand weiterhelfen kan