Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Converting 2 byte (uint16_t) into degrees°



  • Please log in to reply
2 replies to this topic
Spawnova
  • Members
  • 279 posts
  • Last active: Dec 22 2015 03:07 AM
  • Joined: 29 Jun 2011

Hello, I am curious about the equation for converting 2 bytes into degrees such as 65535 = 360°

 

I've searched Google but could not find much, and I've tried value/180 but at 65535 it returns 364.

 

 



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012
✓  Best Answer

How's this work for you?

 

degrees:=Round(two_bytes/182.04166666666666666666666666667)

 

I got that number by doing 65535/360 to divide it into equal parts.

 

If you were fine with decimals, you can of course drop the Round function.



Spawnova
  • Members
  • 279 posts
  • Last active: Dec 22 2015 03:07 AM
  • Joined: 29 Jun 2011

Yup that should be fine, thanks. =P