Esempio n. 1
0
task main() {
  int _chVal = 0;
  nxtDisplayTextLine(3, "MAX127");
  nxtDisplayTextLine(4, "Test prog");
  wait1Msec(1000);
  eraseDisplay();

  while(true) {
    eraseDisplay();
    for (int i = 0; i < 8; i++) {
      _chVal = MAX127readChan(MAX127, MAX127_I2C_ADDR, i);
      // if the return value is < 0 then an error occurred
      if (_chVal < 0) {
        nxtDisplayTextLine(4, "ERROR!!");
        wait1Msec(2000);
        StopAllTasks();
      }
      nxtDisplayTextLine(i, "CH[%d]: %d", i, _chVal);
    }
    wait1Msec(100);
  }
}
task main() {
  short _chVal = 0;
  displayTextLine(3, "MAX127");
  displayTextLine(4, "Test prog");
  sleep(1000);
  eraseDisplay();

  while(true) {
    eraseDisplay();
    for (short i = 0; i < 8; i++) {
      _chVal = MAX127readChan(MAX127, MAX127_I2C_ADDR, i);
      // if the return value is < 0 then an error occurred
      if (_chVal < 0) {
        displayTextLine(4, "ERROR!!");
        sleep(2000);
        stopAllTasks();
      }
      displayTextLine(i, "CH[%d]: %d", i, _chVal);
    }
    sleep(100);
  }
}