# Debugging code on the Spark

**URL:** <https://community.particle.io/t/debugging-code-on-the-spark/4706>\
**Category:** Troubleshooting\
**Created:** [May 29, 2014, 9:43pm UTC](https://community.particle.io/t/debugging-code-on-the-spark/4706 "2014-05-29T21:43:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zucki](https://avatars.discourse-cdn.com/v4/letter/z/ba8739/32.png) [@zucki](https://community.particle.io/u/zucki)\
**Post date:** [May 29, 2014, 9:43pm UTC](https://community.particle.io/t/debugging-code-on-the-spark/4706/1 "2014-05-29T21:43:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Hypnopompia](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/hypnopompia/32/9039_2.png) [@Hypnopompia](https://community.particle.io/u/Hypnopompia)\
**Post date:** [May 29, 2014, 9:45pm UTC](https://community.particle.io/t/debugging-code-on-the-spark/4706/2 "2014-05-29T21:45:33Z")

</div>

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

[http://docs.spark.io/firmware/#data-and-control-spark-publish](http://docs.spark.io/firmware/#data-and-control-spark-publish)

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

[http://docs.spark.io/api/#reading-data-from-a-core-events](http://docs.spark.io/api/#reading-data-from-a-core-events)

---

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [May 29, 2014, 9:51pm UTC](https://community.particle.io/t/debugging-code-on-the-spark/4706/3 "2014-05-29T21:51:45Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![akrusen](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/akrusen/32/2905_2.png) [@akrusen](https://community.particle.io/u/akrusen)\
**Post date:** [June 15, 2014, 11:34am UTC](https://community.particle.io/t/debugging-code-on-the-spark/4706/4 "2014-06-15T11:34:00Z")

</div>

> [@bko](#):
>
> I also use a serial LCD display

Do you have recommendations for this?

---

<div class="post-metadata">

**Author:** ![bko](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bko/32/20704_2.png) [@bko](https://community.particle.io/u/bko)\
**Post date:** [June 15, 2014, 1:01pm UTC](https://community.particle.io/t/debugging-code-on-the-spark/4706/5 "2014-06-15T13:01:43Z")

</div>

Hi @akrusen

I use this one

> **[SparkFun Serial Enabled 16x2 LCD - White on Black 3.3V - LCD-09067 - SparkFun...](https://www.sparkfun.com/products/9067)**
>
> The serial enabled LCD allows you to control a parallel based LCD over a single-wire serial interface. Included in this product is a white on black 16x2 LC
