I've started a new project that requires input from a sonar aka a hand in front to open the lid using a servo. Once the hand is taken away, the servo will reset (closing the lid) which presses a limit switch and turns on a UV light which will turn on for either 10 minutes or until the lid is reopened.
here's what i have so far, mainly mocked up so its not correct
I've coded in python and an engineering language, but never c++
#include <iostream>
using namespace std;
void Sonar_Setup() // run at setup once
{
#define TRIGGER_PIN 20 // Arduino trigger pin on sonar
#define ECHO_PIN 21 // Arduino echo pin on sonar
#define MAX_DISTANCE 200
}
if
//if sonar value = true (values that would be close to the sonar))
//the servo will set to the specific point needed
else
//the servo will not move or will reset to the srtart point
if
//if limit switch= yes
//uv light will turn on for 10 minutes or until values changes
else
//uv light will turn off
int main()
if ()