我将外部传感器连接到天空mote的GIO端口。如何从天空mote的GIO引脚获取数据。
PS:我正在使用contiki os
P2DIR&= ~0x08; // set the port as input
P2SEL &= ~0x08;
P2REN |= 0x08;
if( (P2IN & 0x08) == 0)
{
SEND_STRING(&s->sout,"UP");
}
else
{
SEND_STRING(&s->sout,"Down");
}
帮助我如何从contiki os中的天空mote的GIO引脚读取数据
提前谢谢。
答案 0 :(得分:0)
此代码用于获取GIO2 OF SKY-MOTE
P2DIR&= ~0x08; // set the port as input
P2SEL &= ~0x08;
P2REN |= 0x08;
if( (P2IN & 0x08) == 0)
{
SEND_STRING(&s->sout,"UP");
}
else
{
SEND_STRING(&s->sout,"Down");
}