CAVEDU教育團隊技術部落格 / NXC/RobotC/C++ for Lego robot

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

✍ CAVEDU 阿吉 - 雜工📅 2009-10-12👁 631
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個光感應器的位置.

本文發表於NXC/RobotC/C++ for Lego robot,並標記mindsensors。

相關文章 📎

[RobotC] 藍牙傳輸馬達編碼器值

2014-05-23

[RobotC] Sariel 的 遙控NXT

2012-11-04

[簡易數學應用]移動平均法

2012-05-12

[C++] NXT++ Library

2012-04-08

留言 💬 (0)

還沒有留言,來當第一個。