Subscribe to Arduino Academy and start learning today for FREE!

Emulating An Arduino Sketch in a Spreadsheet

Many times I’ll mock up my Arduino formulas in a spreadsheet before I start building a sketch. One of the more complicated Arduino commands to emulate is the MAP command.

The Arduino code:

height = map(adc, 171, 512, 12, 0);

In Excel becomes:

= (adc-in_min)*(out_max-out_min) / (in_max-in_min) + out_min

The following emulates a voltage divider that converts a fluid level of a container to gallons. It uses a reverse map as decreasing resistance of the sensor means increasing depth.

Become the Maker you were born to be. Try Arduino Academy for FREE!

 

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Archives

0
Would love your thoughts, please comment.x
()
x