-1

My l298n motor driver that is hooked up to my rpi beeps and the motors don't move when i run code how ever i worked before a changed the power pack however now it doesn't work with that one either.

Here's my code:

# import curses
import curses

# Get the curses window, turn off echoing of keyboard to screen, turn on
# instant (no waiting) key response, and use special values for cursor keys
screen = curses.initscr()
curses.noecho() 
curses.cbreak()
screen.keypad(True)

try:
        while True:   
            char = screen.getch()
            if char == ord('q'):
                break
            elif char == curses.KEY_UP:
                print "up"
            elif char == curses.KEY_DOWN:
                print "down"
            elif char == curses.KEY_RIGHT:
                print "right"
            elif char == curses.KEY_LEFT:
                print "left"
            elif char == 10:
                print "stop"    

finally:
    #Close down curses properly, inc turn echo back on!
    curses.nocbreak(); screen.keypad(0); curses.echo()
    curses.endwin()

And my setup: photos will be up later sorry i gotta stop using google drive

  • 1
    "how ever i worked before a changed the power pack" - I doubt it. That code may print text, but nothing else! – Milliways Jan 30 at 22:56
  • 2
    Please write proper sentences i don't like to sort them out it makes it better readable people could be frustrated to answer. – Ingo Jan 31 at 1:33

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.