 };
 
  
-class SlowPWMdemo: public SlowPWM {
+class SlowPWMdemo: public SoftPWM {
 public:
-  using SlowPWM::SlowPWM;
+  using SoftPWM::SoftPWM;
   //it is a bad idea to do this much in an isr ...
   virtual void onToggle(bool on){
     if(!on){
-      dbg.print("\nSlowpwm:");
+      dbg.print("\nSoftPWM:");
     } else {
       dbg.print(" to ");
     }
     dbg.print(millis());
   }
     
-} spwmdemo(250,750,true);
+} spwmdemo(250,750,false);
 
 RegisterTimer(spwmdemo);
 

/**
 * this could have been implemented with two PolledTimer's triggering each other, but that uses more critical resources than coding it directly.
*/
class SlowPWM: public PolledTimer {
protected:
  Ticks pair[2];
  bool phase;

const InputPin<6, LOW> button1;
const InputPin<7, LOW> button2;

#include "motorshield1.h"

#include "timerservice.h"

#include "retriggerablemonostable.h"

RetriggerableMonostable lamprey(red, Ticks(350));
RegisterTimer(lamprey);
void triggerPulse(){
  lamprey.trigger();
}

#define Show(arg) dbg.print("\n" #arg ":");dbg.print(arg)

#include "interruptPin.h"
void greenLight() {
  green = button2;
  RX=green;
  if(button2){
    M2=1*(1-button1);//go forward unless other button is pressed in which case stop
  }
  dbg.print("G");
  dbg.print(millis());
}
const InterruptPin<greenLight, button2.number, CHANGE> greenirq;

void redLight(){
  red = button1;
  TX=red;
  if(button1){
    M2=-1*(1-button2);//see greenLight();
  }
  dbg.print("R");
}
const InterruptPin<redLight, button1.number, CHANGE> redirq;
//const InterruptPin<triggerPulse,button1.number,FALLING> redirq;
