Exemple #1
0
int main(void) {
  setup();
  all_off();
  onboardled(ON);
  around_the_world();

  // blink
  while (1) {
    if(PIND & (1<<5)) {
      onboardled(ON);
      ultraviolet(ON);
      headlamp(ON);

      handlebars(ON);
      forks(ON);
      backleft(ON);
      backright(ON);
      rack(OFF);
      _delay_ms(250);

      forks(OFF);
      rack(ON);
      _delay_ms(150);

      forks(ON);
      handlebars(OFF);
      backleft(ON);
      backright(OFF);
      rack(OFF);
      _delay_ms(250);

      handlebars(ON);
      backleft(OFF);
      backright(ON);
      _delay_ms(250);
    } else  {
      all_off();
      onboardled(ON);
      _delay_ms(350);
      onboardled(OFF);
      _delay_ms(350);
    }
  }
}
Exemple #2
0
void all_off() {
  onboardled(OFF);
  ultraviolet(OFF);
  headlamp(OFF);
  handlebars(OFF);
  forks(OFF);
  rack(OFF);
  backleft(OFF);
  backright(OFF);
}
Exemple #3
0
int main(int argc, char **argv) {
	char *progname;
	char *ext;
	progname = basename(argv[0]);
	ext = strrchr(progname, '.');
	if (ext != NULL) ext[0] = '\0';
	switch(*progname) {
		case 'c':
			if(!strcmp(progname, "cpu"))
				return cpu(argc, argv);
			break;
		case 'e':
			if(!strcmp(progname, "entropy"))
				return entropy(argc, argv);
			break;
		case 'f':
			if(!strcmp(progname, "forks"))
				return forks(argc, argv);
			if(!strcmp(progname, "fw_packets"))
				return fw_packets(argc, argv);
			break;
		case 'i':
			if(!strcmp(progname, "interrupts"))
				return interrupts(argc, argv);
			if(!strncmp(progname, "if_err_", 6))
				return if_err_(argc, argv);
			break;
		case 'l':
			if(!strcmp(progname, "load"))
				return load(argc, argv);
			break;
		case 'm':
			if(!strcmp(progname, "memory"))
				return memory(argc, argv);
			if(!strcmp(progname, "munin-plugins-c"))
				return busybox(argc, argv);
			break;
		case 'o':
			if(!strcmp(progname, "open_files"))
				return open_files(argc, argv);
			if(!strcmp(progname, "open_inodes"))
				return open_inodes(argc, argv);
			break;
		case 'p':
			if(!strcmp(progname, "processes"))
				return processes(argc, argv);
			break;
		case 's':
			if(!strcmp(progname, "swap"))
				return swap(argc, argv);
			break;
		case 't':
			if(!strcmp(progname, "threads"))
				return threads(argc, argv);
			break;
		case 'u':
			if(!strcmp(progname, "uptime"))
				return uptime(argc, argv);
			break;
	}
	return fail("unknown basename");
}