#include "Flex44.h"

#define LeftMotorOn(speed,duration)    analogWrite(1, speed);\
                                       GREEN;\
                                       delay(duration)
                                       
#define LeftMotorOff                   analogWrite(1, 0xff);\
                                       LEDS_OFF;
                                       
#define RightMotorOn(speed,duration)   analogWrite(2, speed);\
                                       BLUE;\
                                       delay(duration);
                                       
#define RightMotorOff                  analogWrite(2, 0xff);\
                                       LEDS_OFF;
                                       
#define BothMotorOn(speed,duration)    analogWrite(1, speed);\
                                       analogWrite(2, speed);\
                                       PURPLE;\
                                       delay(duration);
                                       
#define BothMotorOff(duration)         analogWrite(1, 0xff);\
                                       analogWrite(2, 0xff);\
                                       LEDS_OFF;\
                                       delay(duration);               
                       
// Set up the LED outputs
void setup()
{ 
  BothMotorOff(1);
  pinMode(1, OUTPUT); 
  pinMode(2, OUTPUT); 
}

// Main program:
void loop()
{
  RightMotorOn(0xaa,1000);
  RightMotorOff(1000);

  LeftMotorOn(0x00,1000);
  LeftMotorOff(1000);  
  
  BothMotorOn(0xaa,1000);
  BothMotorOff(1000);
}
