Mindsensors 分別讀取8個light sensor值 in NXC (by祥瑞)

Mindsensor LineLeader 說明文件

task main() {
     SetSensorLowspeed(S1);
     int address;
     int ret;
     int value;
     int buf[8];
     
     while(true) {
          for(address=0x49; address<=0x50; address++){
               ret = I2CRead(S1, 2, buf);
               value = (ret == 0 ? (buf[0] & 0xff) : -1);
              NumOut(0, (address-0x49)*LCD_LINE1, value);
          }
     Wait(200);
     ClearScreen();
     }
}

0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50就是 Lineleader的8個光感應器的位置.

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *