#pragma config(Sensor, S1, MSSMUX, sensorI2CCustom)
#define MONNKEY01 "monkey01.ric"
#define MONNKEY02 "monkey02.ric"
#define MONNKEY03 "monkey03.ric"
#define MONNKEY04 "monkey04.ric"
#define MONNKEY05 "monkey05.ric"
#define MONNKEY06 "monkey06.ric"
#define MONNKEY07 "monkey07.ric"
#include "drivers/mindsensors-sensormux.h"
tSensors disco[] = {sensorCOLORGREEN, sensorCOLORBLUE, sensorCOLORRED};
task danceMOnkeyDance()
{
const int X_COORD = 30;
const int Y_COORD = 0;
const int WAITTIME = 100;
while (true) {
nxtDisplayRICFile(X_COORD,Y_COORD, MONNKEY01);
wait1Msec(WAITTIME);
nxtDisplayRICFile(X_COORD,Y_COORD, MONNKEY02);
wait1Msec(WAITTIME);
nxtDisplayRICFile(X_COORD,Y_COORD, MONNKEY03);
wait1Msec(WAITTIME);
nxtDisplayRICFile(X_COORD,Y_COORD, MONNKEY04);
wait1Msec(WAITTIME);
nxtDisplayRICFile(X_COORD,Y_COORD, MONNKEY05);
wait1Msec(WAITTIME);
nxtDisplayRICFile(X_COORD,Y_COORD, MONNKEY06);
wait1Msec(WAITTIME);
nxtDisplayRICFile(X_COORD,Y_COORD, MONNKEY07);
wait1Msec(WAITTIME);
}
}
task main()
{
long counter = 0;
nxtDisplayCenteredTextLine(0, "Mindsensors");
nxtDisplayCenteredBigTextLine(1, "SnsrMUX");
nxtDisplayCenteredTextLine(3, "Test 2");
nxtDisplayCenteredTextLine(5, "Connect LEGO");
nxtDisplayCenteredTextLine(6, "Color Sensors");
nxtDisplayCenteredTextLine(7, "to ports 1-4");
wait1Msec(2000);
eraseDisplay();
StartTask(danceMOnkeyDance);
while(true)
{
MSSMUXsetChan(MSSMUX, (counter++%4) + 1);
SetSensorType(MSSMUX, disco[abs(rand() % 3)]);
wait1Msec(abs(rand() % 100) + 100);
}
}