Can anyone walk me through a quick 'Idiots guide to Lookup Tables'?


hi!

i've been reading on lookup tables, of stuff i've read has been advanced, or brute force approach i'm trying avoid.

here goal:

i have tempmin , tempmax i've mapped variable pwm
code: [select]
voltage = map(temp, tempmin, tempmax, 0, 255);

what trying display either percentage or actual voltage based off pwm.  easy right?
code: [select]
voltagedisplay = map(temp, resmin, resmax, 0, 11.8);
lcd.print(f("voltage: "));
lcd.print(voltagedisplay, 0);


except it's not linear.  need more data points, took 34 points in testing , came quick chart.  there no test points below 1.5v it's straight line 0, , on upper end widened test points there little voltage change larger pwm increases, can tell in chart there flat spots.



can explain in layman's terms how accomplish goal?  can muddle through doubt efficient solution....

eventually base pwm voltage control off of temperature , convert linear output (i.e. 1c° increase = 1v increase) right increase 1c° close 5.5v on bottom end , less 0.5v on top end.  if can figure out lookup tables display voltage, able in turn use control method based off of percentages.  or @ least that's hamster wheel in head squeaking....

the first thing need determine if table ordered, low value high value, or high value low value, entry going up. or table order random?

are look-up values in table unique? if going look-up in table duplicated entries, table of no use you.

paul


 


Arduino Forum > Using Arduino > Programming Questions > Can anyone walk me through a quick 'Idiots guide to Lookup Tables'?


arduino

Comments