IR receiver not working on MegaPi


#1

I am trying to use the IR Receiver on my Ultimate 2.0 robot. I am testing it using the example code InfraredReceiverTest. It compiles and uploads fine. And, when I press any button I get the buttonState message on the serial monitor as expected from the example sketch. But the value for infraredReceiverDecode.available() is never true so infraredReceiverDecode.read() always returns 255.

Yes, I have upgraded the firmware for my MegaPi board.

Thanks as always for your help.
Gary


#2

Hi my dear friend,
I’m not sure about your question.
If you can get the message printed on the serial monitor when press button that means it was working properly.
Please kindly email to support@makeblock.com and enclosed the details what you are concerned. It will be better if you can provide a video or screenshot to show us the problem, thanks.

Makeblock.


#3

I found the problem. The Infrared Receiver ONLY works when connected to port 6. I had it on port 5 of the RJ25 shield on the MegaPi. On port 5 the sketch can tell when a button is pressed, but the button code is not passed. It MUST be connected to port 6 to work properly. I don’t know why this is the case or if it is documented somewhere. I discovered it by trial and error. But I am glad it is now working! Thanks.

Gary


#4

Hi gmeyer1357,

Glad to hear that you figured out the problem.
Usually, the RJ25 Port 5 (with the gray ID) on makeblock main board is used for serial communication so that it is not suitable to connect the IR receiver sensor.
Here is a link introducing the rule of the color ID on the RJ25 ports and the connecting principle between makeblock mainboards and electronic modules (The introduction takes the Orion board as example, but this principle is suitable for all the makeblock main boards).


#5