In today’s Arduino exploration, I introduced my son to an essential programming technique.

No, not “how to read a for loop in C,” though we did that.

Not using the return value of a function as an argument to another function, though we did that: lcd.print(map(analogRead(A0), 0, 1023, 99, 0));

Not printing spaces on a character-cell display to clear prior content when printing a number with varying width.

Not debugging when you print too many spaces to clear content and wrap around overwrite content on another line.

That essential programming technique, the quintessential tool of the software professional, is “google the problem and cut-and-paste code to solve it.”


Michael K Johnson March 26, 2017 21:57

The project was to connect an i2c-connected LCD character display, a DHT-22 digital humidity and temperature sensor, and LDR to the arduino, and post on the screen the current output for each sensor. The “google the problem” was talking to the i2c-connected LCD since the built-in arduino lcd library only supports parallel connections to HD44780-style LCD controllers.

Curtis Olson March 27, 2017 07:02

Ever had those days when you are googling the problem, but mostly just find your own questions you’ve posted over the past 3 years trying to get help or ideas for solving the problem?

Michael K Johnson March 27, 2017 08:33

+Curtis Olson that might take more persistence than I possess! :-P

Imported from Google+ — content and formatting may not be reliable