从arduino到netmf

时间:2013-09-10 22:34:39

标签: c# arduino .net-micro-framework

有人可以帮助我将一些代码从arduino项目翻译成netmf .. 这是我从arduino项目得到的:

int angle = 3000//angle is int 500 to 5500

unsigned int temp;
byte pos_hi,pos_low;

temp = angle & 0x1f80;  //get bits 8 thru 13 of position
pos_hi = temp >> 7;     //shift bits 8 thru 13 by 7
pos_low = angle & 0x7f; //get lower 7 bits of position

如何转换为C#中的netmf项目?

1 个答案:

答案 0 :(得分:0)

uint angle = 3000;//angle is int 500 to 5500

uint temp;
byte pos_hi,pos_low;

temp = angle & 0x1f80;  //get bits 8 thru 13 of position
pos_hi = (byte) (temp >> 7);     //shift bits 8 thru 13 by 7
pos_low = (byte) (angle & 0x7f); //get lower 7 bits of position