|
#pragma config(Sensor, S1, MAX127, sensorI2CCustomStd) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*// /* * $Id: MAX127-test1.c 20 2009-12-08 22:59:13Z xander $ */ /** * MAX127-driver.h provides an API for the MAXIM MAX127 ADC. This program * demonstrates how to use that API. * * License: You may use this code as you wish, provided you give credit where it's due. * * THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 2.00 AND HIGHER. * Xander Soldaat (mightor_at_gmail.com) * 08 March 2009 * version 0.1 */ #include "drivers/MAX127-driver.h" 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); } } /* * $Id: MAX127-test1.c 20 2009-12-08 22:59:13Z xander $ */