Don't know how to map the result from machine learning sprite extension to mbot2 device


#1

Hello, my name is Ivy T.

I am just starting to explore the machine learning sprite extension. It’s a sprite extension, looks like results need to be mapped to a motor action in device. My plan is to upload via blue tooth, set connection to live and run code from PC using web version of MakeBlock software. I just updated my firmware for mBot2 and Cyberpie.

If I use the mBot2 camera, would this be easier? The camera is a device just like mBot2, I won’t have to use a sprite extension. Today, I just asked my school (I’m a teacher) to buy the mBot2 camera along with the 3-1 smart world add on but that would take some time to arrive. So, I am trying out the machine learning extension. I am suppose to code in Python but decided to use block code to at least make things work first.

I originally used broadcast. The idea is to make mBot2 turn left if result is left. Turn right if result is right.

image2


#2

@ivorymoose Does the Upload Mode Broadcast extension not work for you?


#3

Yep, not working for me. I worked all night. I have a better script now but not working. I am not sure what’s wrong. May be, result variable is not global. I tried the other block that lets me send a number associated with results. Strangely not working either. May be, if I go to sleep, it might work later when I wake up. It’s late I tried hard.

I will post pictures later.


#4

@ivorymoose
In the images you shared, you are using ‘Broadcast’ blocks, not ‘Upload Mode Broadcast’. To use Upload Mode Broadcast, you have to add the extension to your device and sprite.


#5

Hi Best Codes,

Thank you for the prompt reply the last time. I changed the device code to upload mode broadcast and it still did not work. I noticed that in Bluetooth live mode, the upload mode broadcast device codes are blanked out, they are lighted up again when I switch to upload mode but in upload mode, I tried and it also did not work. I simplified the code to only 2 levels of if then else. So that I only have cat (2) or dog (1) but not neither (0). I tried using internet connection but that did not work.

This is what I mean when I say in live mode, the “Upload mode Broadcast” blocks are blanked out in devices.


#6

@ivorymoose Yes, the blocks are only available in Upload Mode, not Live Mode. Also, you are using ‘result’ incorrectly. You should do this instead:

image


#7

Hi Best_Codes

Yehhhhhhhh…my snippet worked! Thanks to you…:grinning::joy::sweat_smile::stuck_out_tongue_closed_eyes:


#8

Awesome, let me know if you need anything else!