arduino_lib_dpformatnumber

Documentation Arduino base program code

DpFormatNumber library

Description

DpFormatNumber Arduino library provide function for converting any type of number to predifine lenght of char array.

Source code is provided as is, without any warranty.

Distributetd under CC BY v 3.0

Functions

// Integer to char array
// Val - number value
// len - length of char array containing - sign and \0 end char
// rightAlign - true/false - right aligne number
// forVal - char array
// return true if conversion is O.K. or false otherwise
// int -32768 - 32767
boolean SigInt2ForStr(int Val, byte len, boolean rightAlign, char forVal[]);

// Byte, unsigned integer, word to char array
// Val - number value
// len - length of char array containing \0 end char
// rightAlign - true/false - right aligne number
// forVal - char array
// return true if conversion is O.K. or false otherwise
// byte 0 - 255, unsigned int 0 - 65535 , word 0 - 65535     
boolean UnsInt2ForStr(unsigned int Val, byte len, boolean rightAlign, char forVal[]);

// Long to char array
// Val - number value
// len - length of char array containing - sign and \0 end char
// rightAlign - true/false - right aligne number
// forVal - char array
// return true if conversion is O.K. or false otherwise
// long -2,147,483,648 to 2,147,483,647
boolean SigLon2ForStr(long Val, byte len, boolean rightAlign, char forVal[]);

// Unsigned long to char array
// Val - number value
// len - length of char array containing \0 end char
// rightAlign - true/false - right aligne number
// forVal - char array
// return true if conversion is O.K. or false otherwise
// unsigned long 0 to 4,294,967,295
boolean UnsLon2ForStr(unsigned long Val, byte len, boolean rightAlign, char forVal[]);

// Float to char array
// Val - number value
// len - length of char array containing - sign, . decimal dot and \0 end char
// dec - number of decimal places
// rightAlign - true/false - right aligne number
// forVal - char array
// return true if conversion is O.K. or false otherwise
// float -3.4028235E+38 to 3.4028235E+38
boolean Float2ForStr(float Val, byte len, byte dec, boolean rightAlign, char forVal[]);

Contact

Author: Dubravko Penezic

Email: dpenezic@gmail.com

Version

Actual

History

V 1.0.0 , 10.01.2012

arduino_lib_dpformatnumber.txt · Last modified: by 127.0.0.1