Bringing stupidity to a new level: macros and searduino

I wanted to test the “syntheseizer” I built (one potentiometer with two piezosummers playing same tone, as set by the potentiometer, in different octaves). And of course some blinking leds.

I spent 30 minutes figuring out why it didn’t work. Seemed to work nice in the Searduino Simulator (wait a week until it’s ready for use). Tons of time checking that the libraries built are ok. Finally, I tested to upload some code from the Arduino examples and, all of a sudden, reading analog pin worked again… and guess what? After a long while I found this:

#define analogRead(p) 500 

Kinda explains why all the delays based on digitalRead I did always took 1/2 a second. It’s hard to love your self after such a mistake. And yes, this really addresses an issue with C.

What you see is NOT what you compile.

One response to “Bringing stupidity to a new level: macros and searduino

  1. BTW, the Arduino libraries as “shipped” by Searduino and developing C/C++ for Arduino (currently uno, due, mega. More boards to come) in emacs works really nice. With one parameter change in the Makefile the simulator code is generated and can be started in either a command line simulator or a python GUI simulator or why not write test scripts in Python🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s