Skip to content

DC Motor #27

@santana1992

Description

@santana1992

i want to control dc motor and i am using MegaPi Encoder/DC Driver V1 for that and i tried;

from megapi import *

if name == ‘main’:
bot = MegaPi()
bot.start()
bot.motorRun(1,0);
sleep(1);
while 1:
sleep(1);
bot.motorRun(1,50);
sleep(1);
bot.motorRun(1,0);
sleep(1);
bot.motorRun(1,-50);
sleep(1);
bot.motorRun(1,0);

this example code from github and this code;

from megapi import *

if name == ‘main’:
bot = MegaPi()
bot.start()
bot.encoderMotorRun(1,0);
sleep(1);
while 1:
bot.encoderMotorRun(1,-200);
sleep(5);
bot.encoderMotorRun(1,0);
sleep(5);

but i cannot run the dc motor although i have attached external power cable and i tried the connection with digital write example to see the blinking leds. if i summary, the connection is seems to be right with digitalWrite code but if it comes to runing motor, it didnt work at all with my python code. Can you please help me to solve the problem.
Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions