I am a beginner in Arduino and have a project with an optocoupler 4N25!
the project is to connect a led through the coupler! just that my teacher wants to know if the arduino can store the state of the coupler!
only that I have a lot of doubts!
I did so:
// declaração das variáveis
int led = 13;
int acoplador = A0;
void setup () {
pinMode (led, OUTPUT);
pinMode (acoplador, INPUT);
}
void loop () {
if (acoplador = HIGH){
digitalWrite (led, HIGH);
}
else {
digitalWrite (led, LOW);
}
}