I just started learning the basics and I am right now stuck to continue. I just get a constant ‘0’ for the Receiver and a ‘1’ for the Emitter. [Check down for code]
I have a classical Arduino UNO board, with an Arduino Shield V2 to be able to connect the Infrared Emitter and the Infrared Receiver. I literally find no proper resources on how to make them work in a single board (I’ve seen just examples with 2), so my first Q’s is: Am I doing wrong by trying to make it work in a single board?.
After that, which it could also be where I am really stuck on here is that I am trying to make it work through the MatLAB program. Simply I find it easier to start with, and as I have to lately send the Block action from the IR’s to a solenoid, in the same circuit, which btw that part already works, so I need your help to finish this small project!
a = arduino(‘COM11’ , ‘Uno’);
for i = 1:10
%Read values of Emitter and Receiver
infrared_Emitter = readDigitalPin(a, ‘D2’)
infrared_Receiver = readDigitalPin(a, ‘D4’)
%once they both have the same value, it means its getting detected (is it?) if(infrared_Emitter == infrared_Receiver) writeDigitalPin(a, 'D09', 1) end
Advices are also gladly welcome,