#define SENSOR_IR 2
#define DRV_OUTPUT 3
void setup() {
pinMode(SENSOR_IR, INPUT_PULLUP);
pinMode(DRV_OUTPUT,OUTPUT);
// put your setup code here, to run once:
}
void loop() {
if(!status_sensorIR(SENSOR_IR))
{
enable_actuator(HIGH);
}
else
{
enable_actuator(LOW);
}
delay(500);
// put your main code here, to run repeatedly:
}
int status_sensorIR(int pin)
{
return digitalRead(pin);
}
void enable_actuator(int status)
{
digitalWrite(DRV_OUTPUT,status);
}