0

I'm doing a project and I am using an HC-06, raspberry PICO, 28BYJ-48 Motor, and a ULN2003 Motor Driver. I coded the motor to turn and everything, and it all works perfectly. I debugged, and the Micropython interpreter shows no errors. I am using an app with it through my HC-06, and for some reason when everything is connected and my Bluetooth module shows as "Connected" on the app, it appears that the motor is not turning. Does anyone know what could be wrong? I am fairly new to Micropython. Here is my code:

from machine import Pin, Timer
from machine import UART
from utime import sleep


uart = UART(0, 9600)

number_of_steps = 1
max_steps = 10

pins = [
    Pin(2, Pin.OUT),
    Pin(3, Pin.OUT),
    Pin(4, Pin.OUT),
    Pin(5, Pin.OUT),
    ]

full_step_sequence = [
    [1,0,0,0],
    [0,1,0,0],
    [0,0,1,0],
    [0,0,0,1]
    ]

back_step_sequence = [
    [0,0,0,1],
    [0,0,1,0],
    [0,1,0,0],
    [1,0,0,0]
    ]


def rotate():
    for step in full_step_sequence:
        for i in range (len(pins)):
            pins[i].value (step[i])
            sleep(0.001)

def rotate_back():
    for step in back_step_sequence:
        for i in range (len(pins)):
            pins[i].value (step[i])
            sleep(0.001)

        

        
while True:
    if uart.any():
        data=uart.read()
        data = str(data)
        print(data)
    
        if ('MUTE' in data):
            rotate()
        elif ('UNMUTE' in data):
            rotate_back()
Jonas
  • 121,568
  • 97
  • 310
  • 388
Elmntz
  • 1
  • 1
    What does your `print(data)` actually print? – Michael Kotzjan May 05 '22 at 05:20
  • I wonder if this is an electronic problem (e.g., devices drawing too much power) rather than a software problem. What if you replace the ULN2003 with some LEDs; do they behave correctly? – larsks May 19 '22 at 23:34

0 Answers0