SabertoothSimplified.h
Go to the documentation of this file.
00001 /*
00002 Arduino Library for Sabertooth Simplified Serial
00003 Copyright (c) 2012-2013 Dimension Engineering LLC
00004 http://www.dimensionengineering.com/arduino
00005 
00006 Permission to use, copy, modify, and/or distribute this software for any
00007 purpose with or without fee is hereby granted, provided that the above
00008 copyright notice and this permission notice appear in all copies.
00009 
00010 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
00011 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
00012 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
00013 SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
00014 RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
00015 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
00016 USE OR PERFORMANCE OF THIS SOFTWARE.
00017 */
00018 
00019 #ifndef SabertoothSimplified_h
00020 #define SabertoothSimplified_h   
00021 
00022 #if defined(ARDUINO) && ARDUINO >= 100
00023 #include <Arduino.h>
00024 #else
00025 #include <WProgram.h>
00026 #endif
00027 
00028 #if defined(USBCON)
00029 #define SabertoothTXPinSerial Serial1 // Arduino Leonardo has TX->1 on Serial1, not Serial.
00030 #else
00031 #define SabertoothTXPinSerial Serial1
00032 #endif
00033 #define SyRenTXPinSerial SabertoothTXPinSerial
00034 
00039 class SabertoothSimplified
00040 {
00041 public:
00046   SabertoothSimplified();
00047   
00053   SabertoothSimplified(Print& port);
00054 
00055 public:
00060   void motor(int power);
00061   
00067   void motor(byte motor, int power);
00068   
00073   void drive(int power);
00074   
00079   void turn(int power);
00080   
00084   void stop();
00085   
00086 private:
00087   void mixedMode(boolean enable);
00088   void mixedUpdate();
00089   void raw(byte motor, int power);
00090   
00091 private:
00092   boolean _mixed;
00093   int     _mixedDrive, _mixedTurn;
00094   boolean _mixedDriveSet, _mixedTurnSet;
00095   Print&  _port;
00096 };
00097 
00098 #endif


ric_mc
Author(s): RoboTiCan
autogenerated on Thu Aug 27 2015 14:39:50