OttoDIY / blockly

Otto Blockly; a fully integrated graphical programming for any type of Arduino projects, including robots, ready to install in your computer, it works offline and also online
https://www.ottodiy.com/software
GNU General Public License v2.0
114 stars 80 forks source link

Mouth - display variable #22

Closed brendonhatcher closed 4 years ago

brendonhatcher commented 4 years ago

I created an int variable and declared it. I added the Mouth block and tried to connect the variable block to it. Instead of showing the number, the led matrix displays the name of the variable.

The variable is storing an integer value. If I use the Pixel X/Y block, I can use the value of the variable to input the X and Y coordinates.

The "S" in the attached image is Otto scrolling the word CLAPS

Otto clap

cparrapa commented 4 years ago

i]I got your idea is pretty cool you want Otto to turn led by led every time you clap. ok i found out how to fix, basically the variable need to be converted, actually we had this already! somehow it did not appear in the installer release if you wanna give a try you can this:

include

Otto9Humanoid Otto;

int CLAPS = 0; const char data[] = "VARIABLE"; //9 characters MAXIMUM

define DIN_PIN A3

define CS_PIN A2

define CLK_PIN A1

define LED_DIRECTION 1

void setup() { Otto.initMATRIX( DIN_PIN, CS_PIN, CLK_PIN, LED_DIRECTION); }

void loop() { CLAPS = CLAPS + 1; itoa(CLAPS, data, 10); // convert integer into a string so we can display this on the matrix Otto.clearMouth(); Otto.writeText ( data,50); // show the data with a fast scroll delay(1000); }

Like this it should work the variable, we would integrate this into the block for next release. Thanks

cparrapa commented 4 years ago

ok solved here https://github.com/OttoDIY/blockly/commit/eb144a958a705dfbbeeddb8ab79ae72d074bc9a9