Notifications
Clear all

pi pico TB6612fng

7 Posts
2 Users
0 Likes
177 Views
(@videogame95)
Member
Joined: 3 years ago
Posts: 27
Topic starter  

This code is from Christopher Bennett on youtube 3 years old

I'm running it in Micopython and it is running fine with no errors but my motor one motor test isn't running this code was for the L2986N board I've added a 9.5 battery box.

from time import sleep
from machine import Pin

Mot_A_Forward = Pin(20, Pin.OUT)
Mot_A_Back = Pin(21, Pin.OUT)
Mot_B_Forward = Pin(18, Pin.OUT)
Mot_B_Back = Pin(19, Pin.OUT)

def move_forward():
Mot_A_Forward.value(1)
Mot_B_Forward.value(1)
Mot_A_Back.value(0)
Mot_B_Back.value(0)

def move_backward():
Mot_A_Forward.value(0)
Mot_B_Forward.value(0)
Mot_A_Back.value(1)
Mot_B_Back.value(1)

def move_stop():
Mot_A_Forward.value(0)
Mot_B_Forward.value(0)
Mot_A_Back.value(0)
Mot_B_Back.value(0)

def move_left():
Mot_A_Forward.value(1)
Mot_B_Forward.value(0)
Mot_A_Back.value(0)
Mot_B_Back.value(1)

def move_right():
Mot_A_Forward.value(0)
Mot_B_Forward.value(1)
Mot_A_Back.value(1)
Mot_B_Back.value(0)

move_stop()
sleep(2)

print ("Forward test")

move_forward()
sleep(2)

print ("Backward test")

move_backward()
sleep(2)

print ("Spin left test")

move_left()
sleep(2)

print ("Spin right test")

move_right()
sleep(2)

print ("'Time for bed' said Zeberdee.")

move_stop()


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6512
 

@videogame95 You are posting in the INTRODUCTION forum. Re-post this in the

'Project Corner/Show and Tell' if you think the few Python users we have will be interested in some copied code.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@videogame95)
Member
Joined: 3 years ago
Posts: 27
Topic starter  

@zander Yes Bill I would like that very much, good news I think I found out my problem I think blown up the Tb66 haha. I followed bills youtube video 

So I solder a new one and wired it up to my copy uno board test with the L298nx2 code but only ran one motor great it works but how do you stop the code running in the IDE?   if you can give a code that controls the esp32 over Bluetooth one motor for the back wheels one servo to stir the front wheels. I'm working on the skull with servo motors and I've had a head nod and turn left and right and the jaw moves up and down. I have been working on this RC  truck as I'm waiting for parts for the skull from AliExpress.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6512
 

@videogame95 First of all I am not Bill, I am @zander or Ron to my friends. Second, I am very sorry, but I do not understand most of what you are saying.

As far as stopping the code running, do you mean other than unplugging it? NOTICE the procedure is named LOOP for a reason. If you want to stop the motors, then that is just normal code, first build some sort of controller interface, joysticks, flight controller, web based, there are a lot and if that sends a stop command and what you want is a poerdown situation then have the code do that (I have never had to do that so don;t have it memorized)

Is there a question in this?

 if you can give a code that controls the esp32 over Bluetooth one motor for the back wheels one servo to stir the front wheels.

Without better communication, and actual code it is impossible to help you.

 

 

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@videogame95)
Member
Joined: 3 years ago
Posts: 27
Topic starter  

Hi Ron I will use the code of the libraries. do you know where they sell the TB6612fng spark fund for £5 or less? 

 I must have overheated the TB66 when soldering it.

I had trouble soldering the first 3 pins when I changed the tip it worked like buttering bread, but I think that the damage had been done.

I have the motors running with code L298nx, with the new TB6612fng.

thanks for your help 


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6512
 

@videogame95 The trick for soldering headers is two fold, a small wedge tip, and liquid flux or even paste. With the liquid, it is almost instantaneous.

I don't know anything about UK purchasing, I am in Canada and paid $18 for 3 of them.

I will no longer respond to this Topic, if you need more help, use the Forum 'Project Corner/Show and Tell

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@videogame95)
Member
Joined: 3 years ago
Posts: 27
Topic starter  

@zander Thanks Ron i got them very cheap from Aliexpress but it takes three weeks to get them £1o6 each but the writing is on the bottom. thanks again for your help, Ron.

This post was modified 3 weeks ago by videogame95

   
ReplyQuote