On Event
Under the Advanced blocks you can find the Control blocks. These are the blocks that are the most
complicated to use, but are the most powerful. The
for and a pin that event should happen on. When that specific event is emitted from that pin, it will
trigger whatever code is inside of it. Take a moment to look through the list of different events that
you can listen for!
if / Else if / Else
Finally, inside of the
forever
tree. To build this more complex "if" statement, add a standard
else
program. Then click on this small gear in the upper left-hand corner of the block. This will open a tiny
interface with more blocks in it. You can drag more
your decision tree. Here is what ours looks like:
Once you are done rearranging your "if" statement you can close this menu by clicking on the gear
again.
What You Should See
When you press the button, the RGB will turn on to a color. When you press it again, the color will
change and another press will change the color once again. Press it one more time, and it will turn
off. Every time you press the button, it increments a variable, and then we check against it to set the
color. If the variable goes over the value of 2, we reset it to 0, which is off.
block is a more complex
block accepts an event type to watch
On Event
block, which is an
if
if / else
blocks into the structure here to build
else if
if / if else /
block into your
Need help?
Do you have a question about the Inventor's Kit and is the answer not in the manual?