I think I understand the point you made in paragraph #3 above, but I have no idea how to do it. If I do understand, for my purposes I think I'd still need some kind of conditional on the fact of the button being pressed, and despite several attempts I have not been able to secure the correct statement to include in an if…then… or do …while… function, both of which I tried unsuccessfully. I am sure it is my lack of understanding that is limiting me!
Going the route you suggest in paragraph #4 is conceptually different from what I want to accomplish, though I did try that earlier just to see if I understood the functions themselves.
INSTEAD I have made some [partial] progress by going the following route:
In the Behaviors tab, for cases 11, 14, 12, & 13 I deleted the MoveWithOptions() and the RotateAccurate() functions and substituted Motors() function statements, respectively
Motors(150, 150) for fwd case 11
Motors(-150, -150) for reverse case 14
Motors(0, 75) for left case 12
Motors(75, 0) for right case 13
and since all the flashing leds and chirps are not of particular interest to me here, I re-purposed case 21 as follows
case 21: // "X" key, stop motors
PlayChirp(NOTE_C7,100);
Motors(0, 0);
delay(10);
OffChirp();
break;
The net effect of all this is that after button1 initiates the newly defined DriveWithRemote block, pressing any of the directional arrows on the IRRemote will initiate a continuous [motor] behavior in the expected direction. Pressing another arrow key will substitute that new direction for the previous one, and pressing the "X" key stops Ringo.
I am experiencing what I think may be a Ringo hardware limitation. Ringo itself [does it have a gender?] only receives/acknowledges/accepts a fraction of the IRRemote button presses we make. This makes Ringo's on-the-floor behavior VERY UNRELIABLE and for my grandsons VERY FRUSTRATING. Is this curable in software [adding a delay or some such]??? Or do we perhaps have bad hardware??
For example, my right arrow and left arrow commands cause Ringo to rotate continuously rt and left. Trying to get Ringo to stop rotating so as to go fwd or rev in a specific new direction is almost impossible. There is over-shoot and just plain non-response to the IRRemote. So, I further re-purposed case 18 ["A" key] and case 19 ["B" key] to allow us to interrupt Ringo from fwd or rev motion and then rotate only a given angle [I am using 45° right now] and then remain stopped so we could determine whether he was pretty much headed the new direction we wanted:
case 18: // "A" key, turn left 45°
NavigationBegin();
ZeroNavigation();
PlayAck(); // flash green fwd LED as acknowledgment of IR command
RotateAccurate(-45, 1000); //rotate 45° anti-clockwise for a max of 1 second
break;
case 19: // "B" key, turn right 45°
NavigationBegin();
ZeroNavigation();
PlayAck(); // flash green fwd LED as acknowledgment of IR command
RotateAccurate(45, 1000); //rotate 45° clockwise for a max of 1 second
break;
I chose "A" and "B" keys for this due to their physical location on the IRRemote - on either side of the up-arrow key.
So far, we love the sophistication in possibilities. Ringo's sensors can accomplish fabulously complex response with extremely good precision — PreLoaded Behavior 10 is fabulous. And having the code for DriveWithRemote in the PreLoaded file to begin with was terrific. I could never have gotten going without all that help!!
But we humans find we cannot drive Ringo with sufficient precision around on the floor due to the unreliability of the IRRemote-to-Ringo 'connection'.
JStatistics: Posted by jedward — Fri Oct 23, 2015 10:56 pm
]]>