RoboticsGeneral

How to let maqueen make an exact 90/180/360 degrees turn

userHead elloco999 2019-07-10 07:02:27 6698 Views7 Replies
Hi,

I'm new to the microbit maqueen and programming micro controllers in general. I've been playing around with my maqueen for a bit now and following some tutorials.

I've been trying to program my maqueen to drive a figure 8, making one motor run at full speed for a certain amount of time, then the other motor. But after quite a bit of experimenting, I can't seem to figure out how long to run the motor to make an exact 360 (or 90/180 for that matter) turn. It always seems to be a bit off.

Is there a way to determine how long to run a motor at a certain speed to make a full 360 degrees turn?

Thanks,
elloco
2022-03-22 11:00:40 Barewoods offers premier quality pre-rolls to patients across the board, dedicated to consistency
and an excellent cannabis experience. … Barewoods plans on taking their pre-rolls to everywhere
cannabis is legal and dedicating their high-quality to
the patients they served in their early days. Our original Barewoods blunts are filled with
two grams of lab-tested, hand broken, premium flower with high potency concentrate,
dusted in kief, rolled up in a 100% tobacco free wrap with an engineered glass filter.

https://naturalpsychedelicspharmacy.com/


https://premiumpillsmarket.com/


https://barewoodsjoint.com/


https://barewoodsjoint.com/product/710-king-pen/
userHeadPic princeesikisejones1997
2022-01-26 13:19:33 When an electric current is applied to the armature of a brushed DC motor, the rotor rotates 180 degrees. The electromagnet's poles must flip in order to proceed. The brushes make contact with the stator as the rotor spins, switching the magnetic field and allowing the rotor to spin 360 degrees. userHeadPic boristhompson77
2022-01-23 06:14:11 These new features will improve your resumes by a lot. I have asked the big assignments review people to share some more information about this subject, and once they're done, I will ask them what they did. userHeadPic ligutapo.anasuce
2019-07-25 16:20:28 @elloco999

While the Maqueen does not have any sensors to enable exact 90/180/360 turns, the micro:bit you are using to drive it does have a COMPASS capability, that will provide some level of support. It will not be the exact 90/180/360 precision that you are looking for, but it might help alleviate the problem.

micro:bit COMPASS returns a reading of 0-359 degrees, 0 being North, and in a clockwise rotation.
If you use this reading value and manipulate it a bit with the MATH functions, you can arrive at an approximation of the four cardinal direction. Here is a code sample is JS to do that:
Code: Select all
while (true) {
    compRead = input.compassHeading()
    dir = Math.round(Math.map(compRead, 0, 359, 1, 4))
    basic.showNumber(dir)
    basic.pause(100)
}
Paramaters "1,4" indicate the number of direction points you want: N/E/S/W

You could change that to "1,8" and obtain in-between directions, if you want: meaning the 45 deg turn points.

If you copy and paste the JS code into the JS programming mode, and then switch to the Block programming mode, you 'll get the corresponding blocks.

The example displays the direction calculated on the LED screen. However you can take the DIR variable and do whatever you want with it.

Hope this will help you a bit.
userHeadPic anonymous
2019-07-11 01:59:59 Hi Nana,

Thanks for your reply. It's too bad there is no fixed time to use to determine the degrees turned.
But that does raise the follow up question: is there some kind of sensor I could add like a compass or something to determine when the maqueen has made a full turn?

Thanks,
elloco
userHeadPic elloco999