|
悬赏1乐币未解决
task main()
{
SetSensorColorFull(S4);
//SetSensorColorRed(S4);
unsigned int raw[3]={0,0,0};
unsigned int a1 ;
unsigned int first = ColorSensorValue(S4,0);
int i;
while(true)
{
ClearScreen();
int error;
int power;
// ReadSensorColorRaw(S4 ,raw);
a1 = ColorSensorValue(S4,0);
NumOut(20,20,raw[0]);
NumOut(40,20,raw[1]);
NumOut(60,20,raw[2]);
NumOut(80,20,a1);
NumOut(0,4,i);
i++;
error = a1 - first;
power = error*8;
OnFwd(OUT_A, power);
OnFwd(OUT_B, power);
Wait(100);
}
}
以上程序中 SetSensorColorFull(S4)改为 SetSensorColorRed(S4)
在循环中使用ReadSensorColorRaw(S4 ,raw),貌似只能读取一次,raw里的数值不更新,请问是什么原因?
|
|