[SOLVED] Issues with Upload Mode Broadcast codes and mBot


#1

hi, im attempting to use the mbot2 and the sprite together. ive got he broadcats extensions on both mbot2 and sprite and the following codes:
sprite:wondertwin-2
mbot2:

in short, when button A is prerssed the mbot led should say ‘wonder twin powers’ … activate… form of… then we enter the answer to ‘form of’ into the sprite stage area for the question, when the answer is typed in, the variable ‘form of’ is set to answer… and it send broadcast back to mbot to say the ‘answer’ (the value of ‘form of’)
however, each time all it does, although we see the value of the variable ‘form of’ change on the stage area… it doesnt get transmitted to the mbot2, and the led on the mbot2 shows ‘0’, not the current value of ‘form of’
i also notice, that when the A button is clicked, ive got code to ‘set ‘form of’ to 0’ (which is why the led shows 0 probably…) BUT, when the button is pressed, the value in the stage area stays whatever it last was, until somethnig is typed for answer… thus, its not 'setting ‘form of’ to 0, when the rpogram is started… it stays the last value until the ASK is answered…
if this makes any sense,
thank everyone.


#2

@magicmarc The issue with your code is right here:
image

Change that block to:
image

Variables are not shared between the sprite and CyberPi in Upload Mode, so setting a variable on the sprite changes nothing for the mBot.

The full corrected code would look like this:
For CyberPi:
image

For Sprite:
image


#3

thank you, ill check this out, were in the ‘mode;’ currently, so im using the mbot2 and the original mbot with another class.


#4

this worked best_codes,
THANK YOU… im slowly understanding the mbo2 and the new mblock interface commands and contriols and extensions.


#5

@magicmarc
Awesome! Glad everything worked. :smile: