I would like to know how to comunicate two mBots with the infrared sensors of the Board. The maximum I have achieved is to detect in the mBot a button pulse off the remote control. What I would really like to do is to send ints from the first mBot to the second, but it looks like the mBot infrared code is only thinked for detecting the remote control buttons pulses. If I could just send from the first mBot the same pulse that sends the remote control when you press a button to the second mBot, then I could do a switch case and convert the received button pulse (button 0 for instance) to a number (int received = 0).
Instead of doing so, it would be better to directly send and receive ints or even strings. But at this point any way to comunicate the two mBots with the infrared would be fine to me.
This is the code i have for detecting the button pulse of the remote control in the mBot:
include Wire.h
include SoftwareSerial.h
include MeMCore.h
MeIR ir;
MeBuzzer buzzer;
void setup()
{
ir.begin();
}
void loop(){
if(ir.keyPressed(22)) // receive button 0 pulse
buzzer.tone(460,200); // make a beep
}
ÂżDoes someone know how it will be the code for sending and receiving data between the two mBots? (even if its only the pulses for the button numbers from 0 to 9)
Any help will be apreciated