MeLimitSwitch Device Cross-Mapped


#1

Here is the code I’m looking at:

bool MeLimitSwitch::touched()
{
if(getSlot()==DEV2){
pinMode(s1,INPUT_PULLUP);
}else{
pinMode(s2,INPUT_PULLUP);
}
return getSlot()==DEV2?digitalRead(s1):digitalRead(s2);
}

My question is why is DEV1 mapped to s2 and DEV2 mapped to s1? This seems backwards.


#4

Hi mitch212, thank you for your question. When you use Me MicroSwitch or LimitSwitch, you need use Me RJ25 Adapter to connect the switch to Me Baseboard or BaseShield.

Then i have found the answer from the Me RJ11 Adaper V2.0 Schematic (https://www.makeblock.cc/me-rj11-adaper-v2-0-schematic/). Here is the schematic picture.

It shows that SIG2 is mapped to S1 and SIG1 is mapped to S2.


#5

Yes, that was actually going to be my next question because I noticed the connections on the RJ11 Adapter 2.0 seemed to be “backwards”. Is that fixed on the RJ11 Adapter 2.1 that just came out?


#6

Of course it has been. Thank you for your question again. Keep in touch with us at any time.


#7