Blooper section

How about a blooper section on this forum where we share mistakes we made in programming the Spark?
I recently did something very stupid that resulted in a breathing white led, it took me hours to find the source of the problem: a serial print before serial.begin was called…


We, that almost beats the one where I setup a the chipselect for a display on SPI and nothing seemed to work. I looked at the wiring, at the code to make sure the pin I specified was correct and still not go. Then, after looking at the output on my logic analyzer for some time I realized I was missing a tiny little detail… pinMode()!!! DOH! :stuck_out_tongue:

I have been struck by the pinMode issue…

I have been also struck by an issue with I2C where the communications would stop working after just over 30 bytes… Which I finally worked out was the length of the internal buffer.

But the worst is the couple of hours to work out why the IR code I was trying to write was modulating IR at about 1.32 KHz rather than the 38 KHz. After well over an hour of testing I worked out that I was trying to get a 16 bit number into an 8 bit variable with any warnings hidden due to casting.

And in hardware: Also on the IR side, I could not work out why the IR code would not work most of the time, and even when it did the range was really short. I had a 120 ohm resistor driving a transistor which drove a led through a 15 ohm resistor. What I found was then when it worked I had been playing with the 15 ohm resistor, and connected it to the 120 ohm in series, bypassing the transistor. In effect the LED was being directly by the I/O pin, explaining the short range.

Once I found that out I got the wiring correct and found that the batch of transistors I had were bad.

1 Like