Friday, April 10, 2009

Sumo Bots

sumo bots are very interesting. We are programming our sumo bot with a partner. you have to use specific code or the sumo bot goes crazy. here is an example of this code.



' SumoBot_2.2_Motor_Test.BS2' {$STAMP BS2}' {$PBASIC 2.5}' -----[ I/O Definitions ]-------------------------------------------------LMotor PIN 13 ' left servo motorRMotor PIN 12 ' right servo motor' -----[ Constants ]-------------------------------------------------------LFwdFast CON 1000 ' left motor fwd; fastLFwdSlow CON 800 ' left motor fwd; slowLStop CON 750 ' left motor stopLRevSlow CON 700 ' left motor rev; slowLRevFast CON 500 ' left motor rev; fastRFwdFast CON 500 ' right motor fwd; fastRFwdSlow CON 700 ' right motor fwd; slowRStop CON 750 ' right motor stopRRevSlow CON 800 ' right motor rev; slowRRevFast CON 1000 ' right motor rev; fast' -----[ Variables ]-------------------------------------------------------pulses VAR Byte ' servo pulses counter' -----[ Initialization ]--------------------------------------------------Reset:LOW LMotor ' initialize motor outputsLOW RMotorPAUSE 2000 ' time to disconnect cable' -----[ Program Code ]----------------------------------------------------Main:FOR pulses = 1 TO 65 ' fwd slow, ~12 inchesPULSOUT LMotor, LFwdSlowPULSOUT RMotor, RFwdSlowPAUSE 20NEXTFOR pulses = 1 TO 25 ' fwd fastPULSOUT LMotor, LFwdFastPULSOUT RMotor, RFwdFastPAUSE 20NEXTFOR pulses = 1 TO 50 ' fwd fastPULSOUT LMotor, LFwdFastPULSOUT RMotor, RFwdFastPAUSE 20NEXTEND



This is a code that tests your motor to make it go straight. the code is very simple if you have payed attention in the class or have expirimented with these sumo bots.

No comments:

Post a Comment