// Macros that define the port each sensor is connected to. #define SP_LIGHT 2 void main() { int loopCount; int lastLsv; int lastLsv12; int lsv; int lsv12; // Sample the light sensor, print out initial value, final // value and if the value changes. loopCount = 0; lastLsv = 0; lastLsv12 = 0; while (1) { lsv = analog(SP_LIGHT); lsv12 = analog(SP_LIGHT); if (lastLsv != lsv) { lastLsv = lsv; lastLsv12 = lsv12; printf("light sensor values, %d, %d.\n", lsv, lsv12); beep(); } sleep(1.0); } }