map float 0-5v


i trying air fuel mixture display correct values on lcd display.
the 0v value 7.35
the 5v value 22.39

with code values min of 7 , max of 22 no decimal points
code: [select]

int lambda0 = 7.35;
int lambda5 = 22.39;

int sensorvalue = analogread(a2);
sensorvalue = map(sensorvalue, 0, 1023, lambda0, lambda5);
float lambdaafr= sensorvalue;


with code values min of 0 , max of 22.39 have no clue how make 0v display 7.35 on lcd
code: [select]

int lambda0 = 7.35;
int lambda5 = 22.39;

int sensorvalue = analogread(a2);
float lambdaafr= sensorvalue * (22.39 / 1023.0);


so helpfull
thanks in advance

code: [select]
int lambda0 = 7.35;

go reference section of site.  @ top of page, learning --> reference.  @ entry int.  study little on types of numbers int can , cannot hold (hint int short integer).  @ of other entries , see if there 1 more appropriate numbers have. 


Arduino Forum > Using Arduino > Programming Questions > map float 0-5v


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts