Variable conversion uint16_t to int

Status
Not open for further replies.

eebhoi01

Advanced Member level 4
Joined
Feb 22, 2012
Messages
116
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
2,347
Hello,

I wish to convert my ADC data (uint16_t, 10bit data) to "int" so I can perform mathematical operations. Basically my goal is to make my version of "map" function in Arduino IDE, ex. int Value = map(ADC, 0, 1024, 0, 255);

So how can I convert uint16_t to int? Thank you in advance.
 

uint is converted to int automatically when making an assignment. This is a feature of the C language. Sized data types used in some libraries like uint16_t are just aliases of the generic C data types and should also undergo automatic conversion.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…