Hi everyone!
I've been trying to get the last project in the official Projects Book working, to no avail. I dismantled an old pocket calculator and made sure I know how to trigger a button press on the membrane underlying the buttons but the circuit wasn't working. My suspicion landed on the optocoupler being faulty, so I built a circuit with two LEDs to keep it simple and test the component - still nothing.
Please see the video: https://www.youtube.com/shorts/k31_U7Y1-H8
The LED before the optocoupler is obstructing a 220Ohm resistor hooked up to digital pin 2 via the red wire. The LED past the optocoupler has the anode connected to pin 5 and the cathode to pin 4 of the optocoupler. The component should be switched on roughly every 4 seconds, as the pre-optocoupler LED indicates. I tried with multiple LEDs and both optocouplers that came with my Kit.
Is it possible that the optocoupler is dead? Or have I misunderstood something completely and the circuit is built wrong?
For completion, the code is as follows:
const int optoPin = 2;
void setup() {
pinMode(optoPin, OUTPUT);
}
void loop() {
digitalWrite(optoPin, HIGH);
delay(500);
digitalWrite(optoPin, LOW);
delay(4000);
}
Any tips much appreciated - thanks!