Enpra example for TA8428

Dependencies:   TA8428 mbed

main.cpp

Committer:
ogata_lab
Date:
2013-05-29
Revision:
0:c6fc29c5ecd0

File content as of revision 0:c6fc29c5ecd0:

#include "mbed.h"
#include "TA8428.h"

DigitalIn sw01(p19);
TA8428 driver(p21, p22);

bool old_sw = false;
bool direction_cw = true;

int main() {
    while(1) {
      bool new_sw = sw01 == 0;
      if (!old_sw && new_sw) {
        direction_cw = !direction_cw;
      }
      old_sw = new_sw;
      
      if (direction_cw) {
        driver.drive(0.5);
      } else {
        driver.drive(-0.5);
      }
    
    }
}