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個光感應器的位置.

About CAVEDU 阿吉 - 雜工 (2520 Articles)
CAVEDU 教育團隊 打雜
Contact: Website

Leave a comment

Your email address will not be published.


*