5

I have 2 Lowpowerlab WaterMote's talking to each other using the 'out of the box' pre-installed sketch that just confirm they're talking to each other. I verified this by opening a COM connection and saw traffic of 'receiving packets...' That was just to show that they are functioning and talking to each other.

Now, using Arduino IDE on Mac OS X 1.9.x (Lion?) I have loaded the WaterMote sketch (found on Github) on the Moteino with the sensor (not the gateway) as it should be. The traffic looks like it's working, except the text being transmitted (number of Gallons) stays the same at 0.02 Gallons.

So... I want to debug the WaterMote sketch, but I do not see an option in my Arduino IDE on Mac OS X. Is there a way to debug sketches using Macs? Searching online shows various and preferred options, but mostly on Windows (of which I don't have any at home).

My current setup

  • Moteino Gateway (as out of the box) connected to a Raspberry Pi (with ssh enabled)
    • Connected via USB to the RasPi
  • Moteino with WaterMote sketch loaded
    • Connected via USB to the MacBook Pro
    • Arduino IDE running, but I see strange "[][][]" square output in the Serial connection.
    • I do not know what to make of this since that text is not in the WaterMote sketch.

Is there a way to debug sketches loaded on Arduino clones using Arduino IDE on Macs?

I found a debugging article:

3
  • 1
    Hello and welcome to Arduino Beta! I cannot find any of these "debugging" pages you are talking about. Can you post a link in your answer? Also, for the strange square output, are you sure you have it on the right baud rate and nothing is connected to pins 1 or 0 on your Arduino clone? Those both could be causes of garbled text in the serial connection window. Mar 1, 2014 at 15:28
  • Yes, please link to these "debugging" tools you have found
    – TheDoctor
    Mar 1, 2014 at 15:43
  • While I did find several articles on how to debug Arduino, I only still had one open, so that's the one I provided (sorry). For those interested, search for "Arduino debugging", "Atmel Arduino", "Arduino Visual Studio" or "Arduino Eclipse". Hope this helps others.
    – Jose Leon
    Mar 1, 2014 at 21:09

1 Answer 1

5

So... I want to debug the WaterMote sketch, but I do not see an option in my Arduino IDE on Mac OS X. Is there a way to debug sketches using Macs? Searching online shows various and preferred options, but mostly on Windows (of which I don't have any at home).

It's definitely possible to debug a sketch with OS X. But it's definitely an advanced AVR topic, and if you're not experienced enough with embedded programming you should first try to avoid it, except if it is really necessary.

Debugging a sketch for an ATmega328 implies:

  • Running a flasher such as the AVR Dragon, the JTAG ICE 3, the STK500 or the AVR ONE; no cheap flasher implements the DebugWire protocol;
  • Setting up the debug fuse, which is an operation that can brick your MCU.

If you're using an ATmega32U4 (or alike), you won't be able to do it out of the box, as the 32U4 needs a JTAG connection for on-chip debugging.

Finally, once you got through that, you can bind a gdb to the AVR using AVaRICE. I'm not getting you through all that, because I really, really, strongly advise you not to do it until you're experienced enough to know what you're doing.

Moteino with WaterMote sketch loaded connected via USB to the MacBook Pro Arduino IDE running, but I see strange "[][][]" square output in the Serial connection. I do not know what to make of this since that text is not in the WaterMote sketch. Is there a way to debug sketches loaded on Arduino clones using Arduino IDE on Macs?

It is very likely you did not setup the correct baudrate for the serial outputs. Arduino IDE defaults to 9600 bits/s connections, whereas the WaterMote source code defines a 115,200 bits/s connection. When you open the Serial Monitor change the setting at the right of the status bar.

And finally, be sure to uncomment the #define SERIAL_EN line to enable the serial communication and debug outputs.

2
  • I did use the 115200 baud rate in Serial connection. I know I set this correctly since that's how I was able to upload the WaterMote sketch. I do have it connected to PIN1 since that's what the WaterMote sketch references but I will keep pluging away "#define INPUTPIN 1". When I find the answer I will post it back here. Thanks all !
    – Jose Leon
    Mar 1, 2014 at 21:23
  • Aha! Now I understand what you meant! Yes, I did have a cable connected to PIN1, BUT since that prevents uploading sketches, that was the problem. I changed the sketch to use PIN2 AND also moved the cable from PIN1 to PIN2. Now the sketch loads properly and, most importantly, I'm able to see Debug information on the Serial console. Thanks so much!!! Now to figure out how to get proper readings.
    – Jose Leon
    Mar 1, 2014 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.