SyRen Simplified Serial Library for Arduino: C:/Code/src/contract/sabertooth-arduino/SyRenSimplified/SyRenSimplified.h Source File

SyRen Simplified Serial Library for Arduino

SyRen Simplified Serial Library for Arduino
Control your SyRen with Simplified Serial.
SyRenSimplified.h
1 /*
2 Arduino Library for SyRen Simplified Serial
3 Copyright (c) 2012-2013 Dimension Engineering LLC
4 http://www.dimensionengineering.com/arduino
5 
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9 
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13 SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
14 RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
16 USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 
19 #ifndef SyRenSimplified_h
20 #define SyRenSimplified_h
21 
22 #if defined(ARDUINO) && ARDUINO >= 100
23 #include <Arduino.h>
24 #else
25 #include <WProgram.h>
26 #endif
27 
28 #if defined(USBCON)
29 #define SabertoothTXPinSerial Serial1 // Arduino Leonardo has TX->1 on Serial1, not Serial.
30 #else
31 #define SabertoothTXPinSerial Serial
32 #endif
33 #define SyRenTXPinSerial SabertoothTXPinSerial
34 
40 {
41 public:
47 
53  SyRenSimplified(Print& port);
54 
55 public:
60  void motor(int power);
61 
67  void motor(byte motor, int power);
68 
72  void stop();
73 
74 private:
75  Print& _port;
76 };
77 
78 #endif