Microchip® Advanced Software Framework

common/applications/sensors/pressure_demo/main.c File Reference

Common Sensor Service Pressure Sensor Example.

Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.

#include <stdio.h>
#include <asf.h>
#include <led.h>


#define ACTIVITY_LED   (LED1)
#define PRINT_BANNER   (true)


int main (void)
 Pressure sensor demonstration application entry. More...

#define ACTIVITY_LED   (LED1)

Referenced by main().

#define PRINT_BANNER   (true)

Referenced by main().

int main ( void  )

Pressure sensor demonstration application entry.

After initializing the development platform and sensors, this application attaches a descriptor to the sensor on an Xplained pressure sensor board. The sensor pressure and temperature data, which is formatted and printed via printf() after being read, can be viewed with a terminal application on a machine attached to the serial interface on the development board.

References ACTIVITY_LED, delay_ms, sensor_data_t::pressure, PRINT_BANNER, sensor_data_t::scaled, sensor_attach(), sensor_device_id(), sensor_get_pressure(), sensor_get_temperature(), sensor_platform_init(), sensor_set_state(), SENSOR_STATE_HIGHEST_POWER, SENSOR_TYPE_BAROMETER, and sensor_data_t::temperature.