Hirdetés

Új hozzászólás Aktív témák

  • schferenc77

    aktív tag

    Sziasztok!
    Van egy DIR/Step vezérlőm (ez a típus). Leírás szerint rákötöttem a DIR+ lábára a GPIO23-at, és a PUL+ lábra a GPIO24-et. Elvileg, ha a GPIO24-et high/low állás között billegtetem, akkor el kellene indulnia a motornak. Ehhez képest a motor búg halkan, de nem mozog. Ez a kód hozzá:
    import RPi.GPIO as GPIO
    import time

    # Variables

    delay = 0.002
    steps = 1000

    GPIO.setmode(GPIO.BCM)
    GPIO.setwarnings(False)

    GPIO.setup(23, GPIO.OUT)
    GPIO.setup(24, GPIO.OUT)

    GPIO.output(23, True)

    StepCounter = 0
    while StepCounter < steps:

    #turning the gpio on and off tells the easy driver to take one step
    GPIO.output(24, True)
    time.sleep(delay)
    GPIO.output(24, False)
    StepCounter += 1

    #Step 7: Clear the GPIOs so that some other program might enjoy them
    #------------------------------------------------------------------------
    #------------------------------------------------------------------------
    #relase the GPIO
    GPIO.cleanup()

    Megint mit rontok el? :O

    Szerk

    Valami python szinten nem oké még. ssh-n tudom állítgatni a 23-as, 24-es pineket outba és high/low állásba. Ugyanakkor, ha ezt a scriptet futtatom, akkor hibával elszáll:
    import RPi.GPIO as GPIO
    import time

    GPIO.setmode(GPIO.BCM)

    GPIO.setup(23, GPIO.OUT)
    GPIO.setup(24, GPIO.OUT)

    GPIO.output(23, True)

    hibának ezt adja:
    osmc@osmc:~/pi$ sudo python write.py
    write.py:6: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
    GPIO.setup(23, GPIO.OUT)
    write.py:7: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
    GPIO.setup(24, GPIO.OUT)
    osmc@osmc:~/pi$

    [ Szerkesztve ]

Új hozzászólás Aktív témák