Compiler Error

Hi. I’m getting a compiler error and I don’t know why. Circuitblocks does not tell me where the error is happening.

here is the link to the ZIP because I am a new user and cant send attachments:

https://drive.google.com/file/d/10cGNcM3RDA2rFb6FOHbUPpTkDs3fiAiv/view?usp=sharing

I ran your code through Arduino and the compiler complains about “Math” not being declared.

Line 57: “return sqrt(Math.pow(X2 - X1, 2) + Math.pow(Y2 - Y1, 2));”

So it looks like math library is missing?
Since CircuitBlocks generated that code it’s an issue with CircuitBlocks.
You will have to do power calculations manually until someone from CircuitMess resolves this.

Also I noticed that you are printing strings to screen without setting font type, size and color.
While that won’t cause compiler errors it will cause game to crash.
I had the same problem until I figured how to display text properly.

Documentation is a bit lacking unfortunately but since it’s still early
in console’s life this is to be expected. I hope CircuitMess will resolve this soon.

Like you I started with CodeBlocks but quickly ditched it and went for the Arduino setup.
It was a pain to set up because I didn’t know how to add support for the Nibble “board” but luckily there is a json on their official GitHub which adds support for the console.

Edit: I see now that you actually do manage text printing properly in setup() function,
so disregard my remark but I’ll leave it in the reply in case someone else experiences the same issue so they know how to solve it.

Hi @jungkook,

Thanks for posting about this. We’ll make sure to troubleshoot this and get back to you soon!

Stay in touch,
-Marija from CM

Hi, thanks for the response. I added the #include <Math.h> code to a new project that was only typed code and I still got the compiler error. I don’t know what’s up with it. I also saw that a circuitmess worker replied. Thank you for all the help.

Hey there! I apologize for not replying earlier, for the past week we’ve had our hands full releasing the programming library for our newest device, Spencer.

I have looked into the sketch you’ve posted, and indeed, this is an issue with the code CircuitBlocks is generating. I’ll make sure to push a hotfix for this, and release an update first thing I do when I get into the office on monday. CircuitBlocks should pull the update automatically when you start it if you’re on Windows or a Mac, and will alert you with a download link if you’re on Linux.

In the next release of CircuitBlocks, which should be around the time the next STEM box device, JayD launches, in about a month, we’ll also add more informative compile error messages so issues like this will be easier to debug.

I’d also just like to point out that when you’re ready to take on manual programming, you can copy the code CircuitBlocks generates, open up the Arduino IDE which CB automatically installed, and continue programming there, with full support for the Nibble device.

Filip