#pragma config(Sensor, S1, HTSPB, sensorI2CCustom9V)
#include "drivers/hitechnic-superpro.h"
task main() {
int wlight;
int wolight;
int lightdelta;
HTSPBsetupIO(HTSPB, 0x3F);
while(true) {
HTSPBwriteIO(HTSPB, 0x00);
wait1Msec(30);
wolight = HTSPBreadADC(HTSPB, 0, 10);
HTSPBwriteIO(HTSPB, 0x01);
wait1Msec(30);
wlight = HTSPBreadADC(HTSPB, 0, 10);
lightdelta = wlight - wolight;
eraseDisplay();
nxtDisplayTextLine(1, "L_On : %4d", wlight);
nxtDisplayTextLine(2, "L_Off: %4d", wolight);
nxtDisplayTextLine(4, "L_Delta: %4d", lightdelta);
wait1Msec(30);
}
}