Studied computer in silicon valley back to 2 decades again and dropped out for another major. 20 years later, picked up an Arduino board and influenced by friends and wanted to start my first project in life. Got stuck somewhere, wish to receive help to complete this project…
Project is simple:
- If light is turned on, IR emitter gives beam to turn on fan.
- If light is turned off, IR emitter gives beam to turn off fan.
- Light level is checked ever second. IR emitter won’t give beam to if status is current.
- All beam signal is RAW, valid, working without function.
- Photocell working fine. Reading is stable.
I used nested (If/ else if) function to decide if
- Light level is on/ off to turn fan on/ off
- Check status of the fan to avoid sending the beam identical to fan status.
- If a light level check sensing the light is on (above ‘PresetLightLevel’) and I try to change a variable named (PrevState) after or before firing a beam, the Photocell does not give more reading in the next loop until the light is turn off (below ‘PresetLightLevel’).
Any help is appreciated
IRTRANS20_test.ino (5.77 KB)