# Light Sensor¶

group index

Overview

This library provides functions to support use of a phototransistor ambient light sensor such as the TEMT6000 as used on the CY8CKIT-028-TFT shield. It uses an ADC to read the relative light level which is returned a a percentage of maximum brightness (0-100).

This library is generic and can be used with any ADC based light sensor.

Quick Start

1. Add the following code to your application. This example initializes the Light Sensor and reads the relative brightness.

2. Note: Define LIGHT_SENSOR_PIN as appropriate for your hardware

#include "cyhal.h"
#include "cybsp.h"
#include "mtb_light_sensor.h"

#define LIGHT_SENSOR_PIN (?) // Define me

mtb_light_sensor_t sensor;

int main(void)
{
cy_rslt_t result;
result = cybsp_init();
CY_ASSERT(result == CY_RSLT_SUCCESS);