#pragma config(Sensor, S1, MSNP, sensorI2CCustomFastSkipStates)
#include "drivers/mindsensors-numericpad.h"
task main () {
int keys = 0;
unsigned byte key[] = {0};
int number = 0;
string output;
nxtDisplayCenteredTextLine(0, "Mindsensors");
nxtDisplayCenteredBigTextLine(1, "NumPad");
nxtDisplayCenteredTextLine(3, "Test 1");
nxtDisplayCenteredTextLine(5, "Connect sensor");
nxtDisplayCenteredTextLine(6, "to S1");
wait1Msec(2000);
eraseDisplay();
nxtDisplayCenteredTextLine(0, "Mindsensors NP");
nxtDisplayTextLine(1, "-------------------");
nxtDisplayTextLine(5, "-------------------");
nxtDisplayTextLine(7, "X: no key");
while (true) {
if (!MSNPscanKeys(MSNP, keys, key[0], number))
StopAllTasks();
output = key;
nxtDisplayTextLine(3, "Numpad Key: %s", output);
nxtDisplayTextLine(4, "Numpad Num: %d", number);
wait1Msec(100);
}
}