We Can Make a Light Flash and Change the Color! |
Today, we started with the basics. For motion, we had to make our Borg move forward, backward, brake, spin-right, spin-left, bear right, and bear left.
To make it go forward , all we had to do was use the blocks talk to abc > move foreword for (10)
Backwards was [reverse > talk to abc > motor on for (10)]
Brakes were [talk to abc > motor on > chirp > motor off ]. We later changed this to [talk to abc > motor off]. The chirp and initial movement block were there so we could be sure it was the stop block that was making the movement end.
Spin right was [talk to a > this way > talk to b > that way > talk to abc > motor on for (10)]
Spin left was [talk to a > that way > talk to b > this way > talk to abc > motor on for (10)]
Bear right was [talk to a > set power (100) > talk to b > set power (90) > talk to abc > motor on for (10)]
Bear left was [talk to a > set power (90) > talk to b > set power (100) >talk to abc > motor on for (10)]
Experimenting with Code |
Some of Our PicoBlocks Procedures |
PicoBlocks Procedures |
We coded [talk to abc > motor on > wait until counta = (1000) > motor off > wait (1) > talk to abc > reverse > motor on > wait until counta = (0) > talk to abc > motor off]
The wait (1) is a precautionary piece. If the SciBorg reverses direction too fast, it can cause the cricket board to fail. The lowest recommended wait time between direction reversals is .2 s, but we made it 1s, just to be safe. The Sciborg started and finished exactly where it began, going forward 1000 rotations, stopping, waiting, and then returning along the same path. The only discrepancy was that when it started, it had tendency to bear right. Fortunately, it maintained this tendency all along the path in both directions, so it did not alter the start and end points.
Countb Moving Forward Until It Reaches (1000) |
Final Product of Code for Today |
No comments:
Post a Comment