コード例 #1
0
ファイル: main.c プロジェクト: mripard/utbm-LO52
/**
 * Initialisation des differents capteurs et du bluetooth
 */
void init(void)
{
	nx_display_clear();
	nx_display_cursor_set_pos(0, 0);
	nx_display_string("Lo52 project\n");
	nx_display_cursor_set_pos(0, 2);

	//on affiche le niveau de la batterie
	nx_display_uint(nx_avr_get_battery_voltage());
	nx_display_cursor_set_pos(4, 2);
	nx_display_string("/4000\n");
	nx_systick_install_scheduler(watchdog);

	// initialise le radar ultrason
	nx_radar_init(RADAR_SENSOR);

	//initialise le bluetooth
	bt_init();
	nx_display_string("bluetooth...OK");

	//initialise le son
	nx__sound_init();

	// initialise le capteur de contact
	nx_sensors_analog_enable(TOUCH_SENSOR);

	//initialise le capteur de luminosité
	nx_sensors_analog_enable(LIGHT_SENSOR);
	nx_sensors_analog_digi_set(LIGHT_SENSOR, DIGI0);

}
コード例 #2
0
ファイル: sensors.c プロジェクト: mripard/utbm-LO52
void sensors_init(void) {
  nx_radar_init(SENSORS_RADAR);
  sensors_wall();
  nx_sensors_analog_enable(SENSORS_TOUCH);
  nx_sensors_analog_enable(SENSORS_LIGHT);
  nx_sensors_analog_digi_set(SENSORS_LIGHT, DIGI0);
}
コード例 #3
0
ファイル: tests.c プロジェクト: hanwenlee/nxos-armdebug
void tests_sensors(void) {
  U32 i, sensor;
  const U32 display_seconds = 15;
  hello();

  for (sensor=0; sensor<NXT_N_SENSORS; sensor++) {
    nx_sensors_analog_enable(sensor);
  }

  for (i=0; i<(display_seconds*4); i++) {
    nx_display_clear();
    nx_display_cursor_set_pos(0,0);
    nx_display_string("- Sensor  info -\n"
		      "----------------\n");

    for (sensor=0; sensor<NXT_N_SENSORS; sensor++){
      nx_display_string("Port ");
      nx_display_uint(sensor);
      nx_display_string(": ");


      nx_display_uint(nx_sensors_analog_get(sensor));
      nx_display_end_line();
    }

    nx_systick_wait_ms(250);
  }

  for (sensor=0; sensor<NXT_N_SENSORS; sensor++) {
    nx_sensors_analog_disable(sensor);
  }

  goodbye();
}