#define MRR 14 // L293D right motor control lead #define MRB 15 // L293D right motor control lead #define MLR 16 // L293D left motor control lead #define MLB 17 // L293D left motor control lead stop_all() { pinhigh(MRR); pinhigh(MRB); pinhigh(MLR); pinhigh(MLB); } drive(ml, mr, dly) // use the polarities of mr and ml to control the turning directions of motors // 1 = forward // -1 = backward // 0 = stop { if(ml > 0) { pinlow(MLB); pinhigh(MLR); } else if(ml < 0) { pinhigh(MLB); pinlow(MLR); } if(mr > 0) { pinlow(MRR); pinhigh(MRB); } else if(mr < 0) { pinhigh(MRR); pinlow(MRB); } if(dly > 0) delay(dly); }