- Ex1: Our hello world example
- a simple demostration of how to write to the LCD
- demo/helloworld.c
int main(int argc, char **argv) {
return 0;
}
- Ex2: generating sounds
- a simple demostration of the RCX playing music
- demo/sound.c
#include <config.h>
#if defined(CONF_DSOUND)
static const note_t devil[] = {
};
int main(int argc,char *argv[]) {
}
return 0;
}
#else
#warning sound.c requires CONF_DSOUND which is not set
#warning sound demo will do nothing
int main(int argc, char *argv[]) {
return 0;
}
#endif // CONF_DSOUND
- Ex3: A line following robot
- a simple demostration of
- demo/linetrack.c
#include <config.h>
#if defined(CONF_DSENSOR) && defined(CONF_DMOTOR)
#define LIGHTSENS SENSOR_2
#define DARK_THRESH 0x40
#define BRIGHT_THRESH 0x48
#define NORMAL_SPEED (2*MAX_SPEED/3)
#define TURN_SPEED (MAX_SPEED)
return LIGHT(LIGHTSENS)<(
unsigned short)data;
}
return LIGHT(LIGHTSENS)>(
unsigned short)data;
}
static void locate_line() {
}
static void follow_line() {
int dir=0;
{
if(dir==0)
else
#ifdef STRAIGHT_LINE
dir=!dir;
#endif
}
}
}
int main(int argc, char *argv[]) {
locate_line();
follow_line();
return 0;
}
#else
#warning linetrack.c requires CONF_DSENSOR and CONF_DMOTOR
#warning linetrack demo will do nothing
int main(int argc, char *argv[]) {
return 0;
}
#endif // defined(CONF_DSENSOR) && defined(CONF_DMOTOR)