jhlucky / maqueen

MakeCode Package for maqueen
20 stars 41 forks source link

Motor Control (code) doesn't work. [Partly] [Solved] #9

Open HaroPo opened 5 years ago

HaroPo commented 5 years ago

Hi, I just tried this:

Makecode Program: https://makecode.microbit.org/_2Cc9gM5P5aDs

Right after, the "micro:Bit" shows its unhappy face with error code 050

I tried to rewrite your code example after re-loading the extension with this link: https://github.com/jhlucky/maqueen , it's visibly loading something, No error in "MakeCode" editor, the "maqueen" blocks category appears with a "m" logo instead of the original "Wi-Fi" logo. After pushing the "untitled.hex" file to the "micro:Bit" board, nothing happens.

I added LED control to my program, to check if the program executes. It does switch On and Off the LEDs from the LEDs matrix of the "Micro:Bit", But, No motor control at all, while everything gets power from the batteries on the robot (USB cable disconnected)...

Any idea about what's (not) happening ??

For more details of my "story", keep reading... ;-)

I just acquired that little "MaQueen" / "McQueen" robot ( https://www.dfrobot.com/wiki/index.php/Micro:Maqueen_Robot_Car(V2.0)_SKU:_ROB0148 ; batch 2018-07-31 ) and a "Micro:Bit" (v1.5) to give a try before acquiring many more sets for a "STEM program" in a school. ( By the way, I need to confirm the order by Monday morning, latest. (I thought that such a very good looking quality product was not going to give me such a bad surprise...) )

Well, first thing first, I wanted to try the "Motor Control": ( https://www.dfrobot.com/wiki/index.php/Micro:Maqueen_Robot_Car(V2.0)_SKU:_ROB0148#Motor_Control )

_Makecode Programming Example Motor Control Learning Target: Mastering the basic method of motor control. Effect: The car forward 1 second, right turn 1 second, left turn 1 second, back 1 second, back and right turn 1 second (Makecode Program: https://makecode.microbit.org/_2Cc9gM5P5aDs )._

Thanks in advance ! ;-)

Best regards, H.P.

_P.S. Here is my own "code" sample: https://makecode.microbit.org/_FqFP6tRF3e3y_

HaroPo commented 5 years ago

Is there a way to know how I could check if the hardware is fine or not ?

I just gave a try, vainly, someone's else code extension ( https://github.com/MKleinSB/maqueen ) found by reading messages from other people... ( https://github.com/jhlucky/maqueen/pull/4 )

I am not sure if the exact same code base or not, thought... :-|

HaroPo commented 5 years ago

Well, I just tried the RGB sample code:

RGB Breathing Ambient Light Learning Target: Learn the basic way of using ambient light. Effect: The RGB ambient light at the bottom of the Maqueen shows a variety of colors and presents a gradient effect.

Makecode Program Link: https://makecode.microbit.org/_WkgPLpAotP3f

At first, same issue as before: "Unhappy face + error code 050" on "Micro:Bit" Second time, after importing the latest extension code from https://github.com/jhlucky/maqueen , things finally worked for the NeoPixels underneath the robot. :-)

I tried again about Motor Control: still Not working. :-|

HaroPo commented 5 years ago

Same story has above for the "LED Light Flash" example.

LED Light Flash Learning Target: Learn the using way of LED light and buzzer. Effect: The left and right LED lights flash alternately, and the buzzer emits two different tone frequencies at intervals of 500 milliseconds.

Makecode Program Link:https://makecode.microbit.org/_6gKRm1RVsDxY

HaroPo commented 5 years ago

My "Motor Control" problem has been solved: US module inserted wrongly !! (now, I can see "SR04" and"IIC"... )

But, the error code 050 does still apply to all code samples that I tried so far.

To help people figuring out this issue quickly, I recommend people to try the following example before any other (the use guide should be updated about this, thought.. ;-) ):

Read Ultrasonic Distance Learning Target: Learn to read the distance of ultrasound, so that later can be flexible use of these data. Effect: The ultrasonic detects the obstruction in front and the distance will be displayed on the dot-matrix screen in centimeters.

Makecode Program Link: https://makecode.microbit.org/_4gi4Dj7yTWgK

Well, please receive my apologises for disturbing you due to such a beginner's mistake. Shame on me ! :-|

Best regards, H.P.

P.S. Should I close this issue or just leave it open until the cope samples have been updated ?

HaroPo commented 5 years ago

Put aside my beginner's mistake (no warning or reminding document/printing in/on the packaging) and those "obsolete" code samples for download, This little robot is a good product, it's confirmed ! :-)

Here is my humble participation to help this little "guy" : my links to all the examples that I updated and "published". Enjoy ! ;-)

  1. Basic Motor Control :
  2. RGB Mood Light :
  3. Red Flash Light + Sound :
  4. Ultra Sound Distance Measuring : https://makecode.microbit.org/_34VTLHJudVTh
  5. IR Remote Control Key-Code Reading : https://makecode.microbit.org/_EMP9EhEXpTJj
  6. IR Remote Control of the Robot : https://makecode.microbit.org/_DtLYPX7gATYE
  7. Line Tracking : https://makecode.microbit.org/_McdMTs9uc3sK
  8. US Sensor Obstacles Avoiding : https://makecode.microbit.org/_gs9FEtDqEcoc
  9. Flash Light Follower : https://makecode.microbit.org/_cTxd1iL4Di1f
  10. Wireless Remote Control : I don't have this remote controller yet.

note: About the # 4, it would be great to be able to select the number of digits after the '.' (dot). 14 to 15 digits seems way too much and takes so long to display that it's easy to miss reading the first significant digits from the next distance measurement...

note:

brometeo commented 5 years ago

Hi. I can't use #4 example in with my micro:bit mcqueen combination. Problem seems to exist with makecode software version. When I use the "old editor", downloaded code for this example works as expected. But going to the url you have posted and downloading same program with new version of makecode editor, nothing happens. Do you know if I am doing anything wrong?

Thank you.

pixeline commented 5 years ago

About the # 4, it would be great to be able to select the number of digits after the '.' (dot). 14 to 15 digits seems way too much and takes so long to display that it's easy to miss reading the first significant digits from the next distance measurement...

Try this:

basic.forever(() => {
    basic.showNumber(Math.abs(maqueen.sensor(PingUnit.Centimeters)))
})
brometeo commented 5 years ago

Hi. I can't use #4 example in with my micro:bit mcqueen combination. Problem seems to exist with makecode software version. When I use the "old editor", downloaded code for this example works as expected. But going to the url you have posted and downloading same program with new version of makecode editor, nothing happens. Do you know if I am doing anything wrong?

Thank you.

Hi again. I have solved my problems with makecode new editor updating micro:bit firmware. Sorry for the noise.

Greets.

HaroPo commented 4 years ago

About the # 4, it would be great to be able to select the number of digits after the '.' (dot). 14 to 15 digits seems way too much and takes so long to display that it's easy to miss reading the first significant digits from the next distance measurement...

Try this:

basic.forever(() => {
    basic.showNumber(Math.abs(maqueen.sensor(PingUnit.Centimeters)))
})

@pixeline Thank you very much ! :-) I'll try this one of these days. (project put on hold since last year...)