Microchip® Advanced Software Framework

lightsensor.c File Reference

Lightsensor application.

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

#include "stdio.h"
#include "adc_sensors.h"
#include "sysfont.h"
#include "bitmaps.h"
#include "keyboard.h"
#include "lightsensor.h"

Macros

#define LIGHTSENSOR_NUM_SAMPLES   200
 Number of light sensor samples to average. More...
 

Functions

void lightsensor_application (void)
 Lightsensor application. More...
 

#define LIGHTSENSOR_NUM_SAMPLES   200

Number of light sensor samples to average.

Referenced by lightsensor_application().

void lightsensor_application ( void  )

Lightsensor application.

This application will output the lightsensor value read by the ADC both as a raw value and by drawing a bar that represent the amount of light hitting the sensor. The raw value is sampled 200 times and the average value is used.

References bitmap_cloud, bitmap_indoor, bitmap_moon, bitmap_sun, gfx_mono_draw_filled_rect, gfx_mono_draw_string(), gfx_mono_put_bitmap, GFX_PIXEL_CLR, GFX_PIXEL_SET, KEYBOARD_BACK, keyboard_get_key_state(), KEYBOARD_RELEASE, keyboard_event::keycode, lightsensor_data_is_ready(), lightsensor_get_raw_value(), lightsensor_measure(), LIGHTSENSOR_NUM_SAMPLES, sysfont, and keyboard_event::type.

Referenced by main().