/*
Motor.h
モータードライバIC(TA7291Pなど)のためのシンプルなライブラリ
### 使い方 ###
#include "Motor.h"
Motor motor;
void setup(){
  motor.attach(5, 6); // pin1は、PWM対応であることが望ましい(5はPWM対応pin)
}
void loop(){
//  motor.mode(GO); //正転
  motor.mode(GO, 100); //0-255(ここでは、100)のスピードで正転
  delay(1000);
  motor.mode(STOP); //停止
  delay(1000);
}
### ライセンス ###
(c)2012 kou029w - MIT License [http://kou029w.appspot.com/mit-license.txt]
*/

#ifndef Motor_h
#define Motor_h

#if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h>
#else
#include <WProgram.h>
#endif

enum { STOP = 0, GO = 1, BACK = 2, BRAKE = 3 };

class Motor{
public:
  void mode(byte mode);
  void mode(byte mode, byte speed);
  void speed(int speed);
  void attach(byte pin1, byte pin2);
private:
  byte _pin1;
  byte _pin2;
};

#endif