LIGHT SENSOR

CODE:

#include “maker_lightSensor.h”

void systemInit()
{

init();
Serial.begin(9600);

}

void maker_Init()
{

}

void maker_Task()
{

int a = maker_getLight(A0);
float p = maker_getLightP(A0);
Serial.print(“A: “);
Serial.println(a);
Serial.print(“Proc: “);
Serial.println(p);
delay(500);

}

int main()

{

systemInit();
maker_Init();

while(1)
{

maker_Task();

}

return 0;

}

Ambient light sensor is analog sensor and it works just like a transistor, and when the light falls on the sensor, the analog output signal increases.

VCC- power supply pin (5V)

GND – ground pin (0V)

A0 – input analog pin

Coded by: