When on board button [event]


#1

Hi @tec_support,

I’m looking at mBlock 3.3.1 on the Mac and wondering how the when on board button [event] hat block is intended to be used. The block doesn’t seem to generate any code in the Arduino IDE when I add it to the Scratch environment and there does not appear to be a way to trigger it other than directly clicking the hat block itself.

Is this a future feature that hasn’t been implemented yet or possibly it is intended for a different board?

Thanks in advance.

Chuck


#2

Hi chuckmcknight,

The when on board button [event] is only for online use, the on board button [event] can be used offline.


#3

Greetings @tec_support,

Can you provide a sample program that uses the when on board button pressed hat block? I’ve tried several things with the mBot on the USB cable, but I can’t seem to get it to trigger.

Thanks!

@chuckmcknight


#4

Hi

Please try the following simple program, when you click on this program, then press the Button on Mcore board, you can see the RGB LED1 and RGB LED 2 will be red on.


#5

Hi @tec_support,

The event hat blocks are usually used as a “subroutine” attached to an event. I used the following program to verify that the the code was working.

The when [green flag] clicked block is required for an event loop or nothing seems to happen.


#6

@chuckmcknight,

Please try following program: