From float to seperate INTs - in an elegant manner :-)


hi, stumbing bit on one.... trying find elegant solution converting float 1 decimal place 3 sperate integer values... so:

float value = 24.8
becomes
int = 2
int b = 4
int c = 8

thanks pointers.

code: [select]
float f = 24.8 ;
int ;
int b ;
int c ;

a = int(f)/10 ; b= int(f)%10 ; c=int((f-int(f))*10) ;


Arduino Forum > Using Arduino > Programming Questions > From float to seperate INTs - in an elegant manner :-)


arduino

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial