- Ex1: display battery voltage
- a simple demostration of reading the battery and writing to the LCD
- demo/batt.C
#include <config.h>
#if defined(CONF_DSENSOR)
int
main(int argc,
char **argv)
{
}
return 0;
}
#else
#warning batt.C requires CONF_DSENSOR
#warning batt demo will do nothing
int main(int argc, char *argv[]) {
return 0;
}
#endif // CONF_DSENSOR
- Ex2: emitting light (Using Lamp from the Ultimate Accessory Set)
- a demostration of the controlling the Lamp
- demo/lampTest.C
#include <config.h>
#if defined(CONF_DMOTOR)
int
main(int argc,
char **argv)
{
int power = 0;
myLite.on();
myLite.brightness(power);
power += (256/8);
}
myLite.off();
return 0;
}
#else // CONF_DMOTOR
#warning lampTest.C requires CONF_DMOTOR
#warning lamp demo will do nothing
int
main(int argc,
char **argv)
{
return 0;
}
#endif // CONF_DMOTOR
- Ex3: generating sounds
- a simple demostration of the RCX playing music
- demo/sound.C
#include <config.h>
#if defined(CONF_DSOUND)
int
main(int argc,
char **argv)
{
}
return 0;
}
#else // CONF_DSOUND
#warning sound.C requires CONF_DSOUND
#warning sound demo will do nothing
int
main(int argc,
char **argv)
{
return 0;
}
#endif // CONF_DSOUND