//-*-c++-*-
#ifndef INCLUDED_RevAsyncBehavior_h_
#define INCLUDED_RevAsyncBehavior_h_
 
#include "Behaviors/StateMachine.h"
#include "Events/EventRouter.h"

class RevAsyncBehavior : public StateNode {

public:
  RevAsyncBehavior() : StateNode("RevAsyncBehavior") {}
 
  virtual void setup() {
#statemachine

startnode: StateNode

			red: LedNode [getMC()->flash(RobotInfo::RedLEDMask,1000);]
			yellow: LedNode [getMC()->flash(RobotInfo::YellowLEDMask,1000);]
			green: LedNode [getMC()->flash(RobotInfo::GreenLEDMask,1000);]
			blue: LedNode[getMC()->flash(RobotInfo::BlueLEDMask,1000);]

			low: SoundNode($,"barklow.wav")
			med: SoundNode($,"barkmed.wav")
			high: SoundNode($,"barkhigh.wav")

			redR: LedNode [getMC()->flash(RobotInfo::RedLEDMask,1000);]
			yellowR: LedNode [getMC()->flash(RobotInfo::YellowLEDMask,1000);]
			greenR: LedNode [getMC()->flash(RobotInfo::GreenLEDMask,1000);]
			blueR: LedNode[getMC()->flash(RobotInfo::BlueLEDMask,1000);]

			lowR: SoundNode($,"barklow.wav")
			medR: SoundNode($,"barkmed.wav")
			highR: SoundNode($,"barkhigh.wav")
			
			sound: StateNode
			light: StateNode
 

			
      red =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> blueR
			red =C=> yellow

			yellow =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> redR
			yellow =C=> green

			green =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> yellowR
			green =C=> blue

			blue =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> greenR
			blue =C=> red


			
			redR =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> yellow
			redR =C=> blueR


			blueR =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> red
			blueR =C=> greenR


			greenR =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> blue
			greenR =C=> yellowR

			yellowR =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> green
			yellowR =C=> redR



			low =C=> med
			low =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> highR
 
			med =C=> high
			med =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> lowR

			high =C=> low
			high =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> medR

			lowR =C=> highR
			lowR =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> med

			highR =C=> medR
			highR =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> low

			medR =C=> lowR
			medR =E(buttonEGID, RobotInfo::GreenButOffset, activateETID)=> high

			startnode =N=> {light, sound}
		  sound =N=> red
			light =N=> low

#endstatemachine
  }       // end of setup()

};

#endif


