These are chat archives for Makeblock-official/mbot_nodebots

28th
Dec 2015
Narciso Jaramillo
@njx
Dec 28 2015 05:56
Hi folks. Just got an mBot for my daughter, and their website was down for awhile, so I couldn't download the stock software. I searched around and ran into the nodebot mBot repo. I got it basically working via bluetooth, and am trying to get the proximity and ultrasonic sensors working. The examples in the repo assume the prox sensor is plugged into port 2 and the ultrasonic sensor is plugged into port 3, but in the standard build the two are reversed. Obviously I could just switch them :), but wanted to keep it compatible with their software. I don't know that much about Arduino, and couldn't immediately figure out how to modify the examples to use the right pins - I tried just changing the sonar.js example to use "A3" (which appears to be the analogous pin on port 3 to pin 10 on port 2, if I'm understanding the labelling), but that didn't seem to work, presumably because it's a different type of pin?
@ajfisher ^^
I also noticed that not all the examples take the port as an option (so don't all work with bluetooth) - I could submit a PR to fix that.
Narciso Jaramillo
@njx
Dec 28 2015 06:18
Figured it out - I guess A3 is pin 17 when used as a digital pin. Would be nice if something in the stack knew to map that automatically, but since I don't really know Arduino I don't even know if that makes sense :)
Now to figure out the reflectance sensor :) - if I plug it into port 3 it gives me values but they don't quite make sense; whereas on port 2 the pins are digital, and ReflectanceArray seems to assume analog pins. I think the mBot sensor might be digital since each side of the light sensor seems to have an on/off LED to show state.
Narciso Jaramillo
@njx
Dec 28 2015 06:34
Yeah, looks like ReflectanceArray doesn't support digital sensors. Oh well.