Debugging code on the Spark

I’m new to Spark and programming in general. One basic trick I’ve learned is when the code does not do what you want (happens a lot to me), you insert print to console lines or create break points. How does one do that in the Spark IDE without having to connect the Spark to the USB port? I feel like I’m flying blind without the ability to see my variables in a print statement as I’m debugging. Thanks for helping.

You could emulate serial print statements with Spark.publish()

and use a simple webpage or curl command to print them on your workstation:


The only minor caveat is that Spark.publish() is rate limited to an average of one per second with a burst of up to four in row. It works great you just have to think about how fast you are spitting out debug prints.

I also use a serial LCD display on Serial1 for debugging. Very handy!


Do you have recommendations for this?

Hi @akrusen

I use this one