GiggleBot: How to address and change the color of the "eyes" in MakeCode

Inviting @cleoqc to participate.

There is an issue with the existing GiggleBot extensions for MakeCode such that the eyes, (the two Neopixels at the front of the 'bot), cannot be addressed as there are no blocks that address them.

Viz.:

Note that there is a variable object for the eyes, but there is no block that you can insert it into.

You can address the eyes by adding some raw code to the JavaScript pane since you can code directly in JavaScript, or flip from blocks to code to see what you’re doing.

The code to insert is:

lights.whichEye(gigglebotWhichEye.Both).showColor(neopixel.colors(NeoPixelColors.Green))

The resultant block code looks like this:

Note that the circled block, though it actually exists, (?!!), is odd.  You will note that the far left hand side of the block has no verb.

You can change which eye, and the color from either the code or the blocks, but it is interesting that the block does not exist, and when present has no verb.

1 Like

“show” is a verb :slight_smile: But agree it isn’t consistent with the other blocks. Should probably have been something like “show color [green] in [both eyes]” to follow the patter of other blocks. But actually I’m impressed that it will backward generate a block at all from a code snippet.

/K

1 Like

. . . but there is no “verb” for the statement block describing what it is.

“show [both eyes] as color [red]” would make sense, but in this case there is no verb or action statement for that block.

P.S.
I am researching how to create these blocks with the idea of correcting that and making the appropriate block available.

1 Like

I’m clearly missing something. In your example “show” would be the verb. Or do you really mean there should be a more descriptive verb/noun pair like “show icon” or “show eye color” to be clear where the action is taking place?

/K

1 Like

The first part of the block, (which in this block is empty), should contain some kind of action - “show”, “drive”, etc., or a condition “if”, “while”, “else”, etc. That tells the user what the block does.

For example, a correctly formed block would be something like this:

Where the [ ] marks are things to insert or a drop-down list.

1 Like

Ah - so you’re saying the verb should always come first. Got it.
/K

1 Like