Lightning Bolt

Hey guys
How would you code the brain to print a lightning bolt on the brain screen. I want it to take up the entire screen. Can you guys help.

Mark Johnson did a demo on adding Vector graphics to IQ. It would be pretty easy to parallel this into VRC programming as well.

1 Like

Just one comment on that video.
Mark places a huge array inside main, he’s getting away with it for that demo, but technically he will be overflowing the stack and it will cause issues if events or other tasks are created.

int array[1000][2]

will use 4 x 1000 x 2 bytes of memory, so about 8k. Each IQ2 task has a 2.5k stack, however, we allow that to overflow when few tasks are used (I’ll explain how I do this some other time).
simple solution is to make the array static, then it will use global memory (which is also limited but the compiler will tell you if you run out).


Can you explain how to make an array static? Thank you.

Include the static keyword when initializing the array, like so:

static int myArray[4];

Yea, I slightly mis-spoke yesterday. Clang actually compiles that array as static because of the size, smart compiler ! Not sure if that is a C++ feature or not, guess I’m still learning after all these years of working with C. Adding static keyword is still appropriate though for clarity.


Does anyone know if the c++ format is better then the block program?

It all depends on personal preference, (I prefer C++ text), but you should make your own topic that way people can discuss the pros and cons there, rather than using an old topic