Upload
others
View
42
Download
0
Embed Size (px)
Citation preview
MainPage Classes Files ExamplesClassList ClassIndex ClassMembers
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
ClassList
Herearetheclasses,structs,unionsandinterfaceswithbriefdescriptions:
USBSabertooth ControlsaUSBSabertoothmotordriverrunninginPacketSerialmode
USBSabertoothSerial CreateaUSBSabertoothSerialfortheserialportyouareusing,andthenattachaUSBSabertoothforeachmotordriveryouwanttocommunicatewith
MainPage Classes Files ExamplesClassList ClassIndex ClassMembers
PublicMemberFunctions|Listofallmembers
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
USBSabertoothClassReference
ControlsaUSBSabertoothmotordriverrunninginPacketSerialmode.More...
PublicMemberFunctions
USBSabertooth(USBSabertoothSerial&serial,byteaddress)
byte address()const
void command(bytecommand,bytevalue)
void command(bytecommand,constbyte*value,size_tbytes)
void motor(intvalue)
void motor(bytemotorOutputNumber,intvalue)
void power(intvalue)
void power(bytepowerOutputNumber,intvalue)
void drive(intvalue)
void turn(intvalue)
void freewheel(intvalue=2048)
void freewheel(bytemotorOutputNumber,intvalue=2048)
void shutDown(bytetype,bytenumber,booleanvalue=true)
void set(bytetype,bytenumber,intvalue)
void setRamping(intvalue)
void setRamping(bytemotorOutputNumber,intvalue)
void setTimeout(intmilliseconds)
void keepAlive()
int get(bytetype,bytenumber)
int getBattery(bytemotorOutputNumber,booleanunscaled=false)
int getCurrent(bytemotorOutputNumber,booleanunscaled=false)
int getTemperature(bytemotorOutputNumber,booleanunscaled=false)
int32_t getGetRetryInterval()const
void setGetRetryInterval(int32_tintervalMS)
int32_t getGetTimeout()const
void setGetTimeout(int32_ttimeoutMS)
boolean usingCRC()const
void useChecksum()
void useCRC()
DetailedDescription
ControlsaUSBSabertoothmotordriverrunninginPacketSerialmode.
Examples:1.Basics/Freewheeling/Freewheeling.ino,1.Basics/PowerOutputs/PowerOutputs.ino,1.Basics/Simplest/Simplest.ino,1.Basics/Sweep/Sweep.ino,1.Basics/TankStyleSweep/TankStyleSweep.ino,2.Settings/Ramping/Ramping.ino,2.Settings/SerialTimeout/SerialTimeout.ino,3.Advanced/Checksum/Checksum.ino,3.Advanced/SharedLine/SharedLine.ino,and3.Advanced/SoftwareSerial/SoftwareSerial.ino.
Constructor&DestructorDocumentation
USBSabertooth::USBSabertooth ( USBSabertoothSerial&byte)
InitializesanewinstanceoftheUSBSabertoothclass.Thedriveraddressissettothevaluegiven,andthespecifiedserialportisused.
Parametersserial TheUSBSabertoothSerialwhoseserialportthemotor
driverison.address Thedriveraddress.
MemberFunctionDocumentation
byteUSBSabertooth::address ( ) const inline
Getsthedriveraddress.
ReturnsThedriveraddress.
voidUSBSabertooth::command ( byte command,byte value)
Sendsapacketserialcommandtothemotordriver.
Parameterscommand Thenumberofthecommand.value Thecommand'svalue.
voidUSBSabertooth::command ( byte command,
constbyte* value,size_t bytes)
Sendsamultibytepacketserialcommandtothemotordriver.
Parameterscommand Thenumberofthecommand.value Thecommand'svalue.bytes Thenumberofbytesinthevalue.
voidUSBSabertooth::drive ( int value )
Controlsthemixed-modedrivechannel.InUserMode,thissetsMD.
Parametersvalue Thevalue,between-2047and2047.
voidUSBSabertooth::freewheel ( int value=2048 )
Causesmotoroutput1tofreewheel.InUserMode,thissetsQ1.
Parametersvalue trueorapositivevalueletsthemotoroutputs
freewheel.falseoranegativeorzerovaluestopsthefreewheeling.
voidUSBSabertooth::freewheel ( bytemotorOutputNumber,
int value=2048)
Causesthespecifiedmotoroutputtofreewheel.InUser
Mode,thissetsQ1orQ2.
ParametersmotorOutputNumber Themotoroutputnumber,1or
2.Youcanalsouseacharacter,suchas'3',toselectthemotoroutputbyitsPlainTextSerialaddress.
value trueorapositivevalueletsthemotoroutputfreewheel.falseoranegativeorzerovaluestopsthefreewheeling.
intUSBSabertooth::get ( byte type,byte number) inline
Getsavaluefromthemotordriver.
Parameterstype Thetypeofchanneltogetfrom.Thiscanbe
'S'(signal),'A'(aux),'M'(motoroutput),or'P'(poweroutput).
number Thenumberofthechannel,1or2.Youcanalsouseacharacter,suchas'3',toselectbyPlainTextSerialaddress.
ReturnsThevalue,orSABERTOOTH_GET_TIMED_OUT.
intUSBSabertooth::getBattery
( byte motorOutputNumber
boolean unscaled=false)
Getsthebatteryvoltage.
ParametersmotorOutputNumber Thenumberofthemotoroutput,1or2.
Youcanalsouseacharacter,suchas'3',toselectbyPlainTextSerialaddress.
unscaled Iftrue,getsinunscaledunits.Iffalse,getsinscaledunits.
ReturnsThevalue,orSABERTOOTH_GET_TIMED_OUT.
intUSBSabertooth::getCurrent ( byte motorOutputNumber
boolean unscaled=false)
Getsthemotoroutputcurrent.
ParametersmotorOutputNumber Thenumberofthemotoroutput,1or2.
Youcanalsouseacharacter,suchas'3',toselectbyPlainTextSerialaddress.
unscaled Iftrue,getsinunscaledunits.Iffalse,getsinscaledunits.
ReturnsThevalue,orSABERTOOTH_GET_TIMED_OUT.
int32_tUSBSabertooth::getGetRetryInterval ( ) const inline
Getsthegetretryinterval.
ReturnsThegetretryinterval,inmilliseconds.
int32_tUSBSabertooth::getGetTimeout ( ) const inline
Getsthegettimeout.
ReturnsThegettimeout,inmilliseconds.
intUSBSabertooth::getTemperature ( byte motorOutputNumber
boolean unscaled=false)
Getsthemotoroutputtemperature.
ParametersmotorOutputNumber Thenumberofthemotoroutput,1or2.You
canalsouseacharacter,suchas'3',toselectbyPlainTextSerialaddress.
unscaled Iftrue,getsinunscaledunits.Iffalse,getsin
scaledunits.
ReturnsThevalue,orSABERTOOTH_GET_TIMED_OUT.
voidUSBSabertooth::keepAlive ( )
Resetstheserialtimeout.Thisisdoneautomaticallyanytimeamotoroutputisset.Youcan,however,callthisifyoudon'twanttosetanymotoroutputs.
voidUSBSabertooth::motor ( int value )
Controlsmotoroutput1.InUserMode,thissetsM1.
Parametersvalue Thevalue,between-2047and2047.
Examples:3.Advanced/SharedLine/SharedLine.ino.
voidUSBSabertooth::motor ( bytemotorOutputNumber,int value)
Controlsthespecifiedmotoroutput.InUserMode,thissetsM1orM2.
ParametersmotorOutputNumber Themotoroutputnumber,1or
2.Youcanalsouseacharacter,suchas'3',toselectthemotoroutputbyitsPlainTextSerialaddress.
value Thevalue,between-2047and2047.
voidUSBSabertooth::power ( int value )
Controlspoweroutput1,ifpoweroutput1isconfiguredasacontrollableoutput.InUserMode,thissetsP1.
Parametersvalue Thevalue,between-2047and2047.
voidUSBSabertooth::power ( byte powerOutputNumber,
int value)
Controlsthespecifiedpoweroutput,ifthepoweroutputisconfiguredasacontrollableoutput.InUserMode,thissetsP1orP2.
ParameterspowerOutputNumberThepoweroutputnumber,1or
2.Youcanalsouseacharacter,suchas'3',toselectthepoweroutputbyitsPlainTextSerialaddress.
value Thevalue,between-2047and2047.
voidUSBSabertooth::set ( byte type,byte number,int value)
Setsavalueonthemotordriver.
Parameterstype Thetypeofchanneltoset.Thiscanbe'M'
(motoroutput),'P'(poweroutput),'Q'(freewheel),or'R'(ramping).
number Thenumberofthechannel,1or2.Youcanalsouseacharacter,suchas'3',toselectbyPlainTextSerialaddress.
value Thevalue,between-16383and16383(thoughinmanycases,only-2047to2047aremeaningful).
voidUSBSabertooth::setGetRetryInterval ( int32_t intervalMS )
Setsthegetretryinterval.
ParametersintervalMS Thecommandretryinterval,inmilliseconds.
voidUSBSabertooth::setGetTimeout ( int32_t timeoutMS ) inline
Setsthegettimeout.
ParameterstimeoutMS Thegettimeout,inmilliseconds.
voidUSBSabertooth::setRamping ( int value )
Setstherampingforallmotoroutputs.InUserMode,thissetsR1andR2.
Parametersvalue Therampingvalue,between-16383(fast)and
2047(slow).
voidUSBSabertooth::setRamping ( bytemotorOutputNumber,
int value)
Setstherampingforthespecifiedmotoroutput.InUserMode,thissetsR1orR2.
ParametersmotorOutputNumber Themotoroutputnumber,1or2.
Youcanalsouseacharacter,suchas'3',toselectthemotoroutputbyitsPlainTextSerial
address.value Therampingvalue,between
-16383(fast)and2047(slow).
voidUSBSabertooth::setTimeout ( int milliseconds )
Setstheserialtimeout.
Parametersmilliseconds Themaximumtimeinmilliseconds
betweenpackets.Ifthistimeisexceeded,thedriverwillstopthemotorandpoweroutputs.AvalueofzerousestheDEScribesetting.SABERTOOTH_INFINITE_TIMEOUTdisablesthetimeout.
voidUSBSabertooth::shutDown ( byte type,byte number,boolean value=true)
Shutsdownanoutput.
Parameterstype Thetypeofoutputtoshutdown.Thiscanbe
'M'(motoroutput)or'P'(poweroutput).number Thenumberoftheoutput,1or2.Youcan
alsouseacharacter,suchas'3',toselectbyPlainTextSerialaddress.
value truesetstheshutdown.falseclearstheshutdown.
voidUSBSabertooth::turn ( int value )
Controlsthemixed-modeturnchannel.InUserMode,thissetsMT.
Parametersvalue Thevalue,between-2047and2047.
voidUSBSabertooth::useChecksum ( ) inline
CausesfuturecommandstobesentCRC-protected(largerpackets,excellenterrordetection).
voidUSBSabertooth::useCRC ( ) inline
Causesfuturecommandstobesentchecksum-protected(smallerpackets,reasonableerrordetection).
booleanUSBSabertooth::usingCRC ( ) const inline
GetswhetherCRC-protectedcommandsareused.Theyare,bydefault.
ReturnsTrueifCRC-protectedcommandsareused.
MainPage Classes Files ExamplesClassList ClassIndex ClassMembers
PublicMemberFunctions|Listofallmembers
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
USBSabertoothSerialClassReference
CreateaUSBSabertoothSerialfortheserialportyouareusing,andthenattachaUSBSabertoothforeachmotordriveryouwanttocommunicatewith.More...
PublicMemberFunctions
USBSabertoothSerial(Stream&port=SabertoothTXPinSerial)Stream& port()
DetailedDescription
CreateaUSBSabertoothSerialfortheserialportyouareusing,andthenattachaUSBSabertoothforeachmotordriveryouwanttocommunicatewith.
Examples:1.Basics/Freewheeling/Freewheeling.ino,1.Basics/PowerOutputs/PowerOutputs.ino,1.Basics/Simplest/Simplest.ino,1.Basics/Sweep/Sweep.ino,1.Basics/TankStyleSweep/TankStyleSweep.ino,2.Settings/Ramping/Ramping.ino,2.Settings/SerialTimeout/SerialTimeout.ino,3.Advanced/Checksum/Checksum.ino,3.Advanced/SharedLine/SharedLine.ino,and3.Advanced/SoftwareSerial/SoftwareSerial.ino.
Constructor&DestructorDocumentation
USBSabertoothSerial::USBSabertoothSerial ( Stream& port
ConstructsaUSBSabertoothSerialobject.
Parametersport Theserialportthemotordriverison.Bydefault,thisistheArduinoTXpin.
MemberFunctionDocumentation
Stream&USBSabertoothSerial::port ( ) inline
Getstheserialportbeingused.
ReturnsTheserialport.
MainPage Classes Files ExamplesClassList ClassIndex ClassMembers
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
ClassIndex
U
U USBSabertoothSerial
USBSabertooth
U
MainPage Classes Files ExamplesClassList ClassIndex ClassMembers
All Functions
a c d f g k m p s t u
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
Hereisalistofalldocumentedclassmemberswithlinkstotheclassdocumentationforeachmember:
-a-
address():USBSabertooth
-c-
command():USBSabertooth
-d-
drive():USBSabertooth
-f-
freewheel():USBSabertooth
-g-
get():USBSabertoothgetBattery():USBSabertooth
getCurrent():USBSabertoothgetGetRetryInterval():USBSabertoothgetGetTimeout():USBSabertoothgetTemperature():USBSabertooth
-k-
keepAlive():USBSabertooth
-m-
motor():USBSabertooth
-p-
port():USBSabertoothSerialpower():USBSabertooth
-s-
set():USBSabertoothsetGetRetryInterval():USBSabertoothsetGetTimeout():USBSabertoothsetRamping():USBSabertoothsetTimeout():USBSabertoothshutDown():USBSabertooth
-t-
turn():USBSabertooth
-u-
USBSabertooth():USBSabertoothUSBSabertoothSerial():USBSabertoothSerial
useChecksum():USBSabertoothuseCRC():USBSabertoothusingCRC():USBSabertooth
MainPage Classes Files ExamplesClassList ClassIndex ClassMembers
All Functions
a c d f g k m p s t u
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
-a-
address():USBSabertooth
-c-
command():USBSabertooth
-d-
drive():USBSabertooth
-f-
freewheel():USBSabertooth
-g-
get():USBSabertoothgetBattery():USBSabertoothgetCurrent():USBSabertooth
getGetRetryInterval():USBSabertoothgetGetTimeout():USBSabertoothgetTemperature():USBSabertooth
-k-
keepAlive():USBSabertooth
-m-
motor():USBSabertooth
-p-
port():USBSabertoothSerialpower():USBSabertooth
-s-
set():USBSabertoothsetGetRetryInterval():USBSabertoothsetGetTimeout():USBSabertoothsetRamping():USBSabertoothsetTimeout():USBSabertoothshutDown():USBSabertooth
-t-
turn():USBSabertooth
-u-
USBSabertooth():USBSabertoothUSBSabertoothSerial():USBSabertoothSerialuseChecksum():USBSabertooth
useCRC():USBSabertoothusingCRC():USBSabertooth
MainPage Classes Files ExamplesFileList
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
FileList
Hereisalistofalldocumentedfileswithbriefdescriptions:[detaillevel1 2]
USBSabertoothUSBSabertooth.h
MainPage Classes Files ExamplesUSBSabertooth
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
USBSabertoothDirectoryReference
Filesfile USBSabertooth.cppfile USBSabertooth.h[code]file USBSabertoothChecksum.cppfile USBSabertoothCommandWriter.cppfile USBSabertoothCRC14.cppfile USBSabertoothCRC7.cppfile USBSabertoothReplyReceiver.cppfile USBSabertoothSerial.cppfile USBSabertoothTimeout.cpp
MainPage Classes Files ExamplesFileList
USBSabertooth
Classes
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
USBSabertooth.hFileReference
Gotothesourcecodeofthisfile.
Classesclass USBSabertoothSerial
CreateaUSBSabertoothSerialfortheserialportyouareusing,andthenattachaUSBSabertoothforeachmotordriveryouwanttocommunicatewith.More...
class USBSabertooth
ControlsaUSBSabertoothmotordriverrunninginPacketSerialmode.More...
DetailedDescription
IncludethisfiletousetheUSBSabertoothArduinolibrary.
MainPage Classes Files Examples
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
Examples
Hereisalistofallexamples:
1.Basics/Freewheeling/Freewheeling.ino1.Basics/PowerOutputs/PowerOutputs.ino1.Basics/Simplest/Simplest.ino1.Basics/Sweep/Sweep.ino1.Basics/TankStyleSweep/TankStyleSweep.ino2.Settings/Ramping/Ramping.ino2.Settings/SerialTimeout/SerialTimeout.ino3.Advanced/Checksum/Checksum.ino3.Advanced/SharedLine/SharedLine.ino3.Advanced/SoftwareSerial/SoftwareSerial.ino
MainPage Classes Files Examples
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
1.Basics/Freewheeling/Freewheeling.ino
Goesinonedirection,letsthemotorfreewheel,andthengoesintheotherdirection.
//FreewheelingSampleforUSBSabertoothPacket
Serial
//Copyright(c)2012-2013DimensionEngineering
LLC
//Seelicense.txtforlicensedetails.
#include<USBSabertooth.h>
//Insteadofbraking,thissampleletsthemotor
freewheel.
USBSabertoothSerialC;//UsetheArduinoTXpin.
ItconnectstoS1.
//SeetheSoftwareSerialexamplein3.Advanced
forhowtouseotherpins.
USBSabertoothST(C,128);//TheUSBSabertoothis
onaddress128(unlessyou'vechangeditwith
DEScribe).
//We'llnameitsobjectST.
//
//Ifyou'vesetupyourSabertoothonadifferent
address,ofcoursechange
//thathere.ForhowtoconfiguretheSabertooth,
seetheDIPSwitchWizardat
//
http://www.dimensionengineering.com/datasheets/
USBSabertoothDIPWizard/start.htm
//BesuretoselectPacketSerialModeforuse
withthislibrary.
voidsetup()
{
SabertoothTXPinSerial.begin(9600);//9600isthe
defaultbaudrateforSabertoothPacketSerial.
//YoucanchangethiswiththeDEScribesoftware,
availableat
//http://www.dimensionengineering.com/describe
}
voidloop()
{
ST.freewheel(1,false);//Turnofffreewheeling.
ST.motor(1,2047);//Goforwardatfull
power.
delay(1000);//Wait1second.
ST.freewheel(1,true);//Turnonfreewheeling.
delay(2000);//Wait2seconds.
ST.motor(1,-2047);//Reverseatfullpower.
ST.freewheel(1,false);//Turnofffreewheeling.
delay(1000);//Wait1seconds.
ST.freewheel(1,true);//Turnonfreewheeling.
delay(2000);
}
MainPage Classes Files Examples
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
1.Basics/PowerOutputs/PowerOutputs.ino
DemonstratestheuseofpoweroutputsP1andP2asadditionalcontrollableoutputs.
//PowerOutputsSampleforUSBSabertoothPacket
Serial
//Copyright(c)2012-2013DimensionEngineering
LLC
//Seelicense.txtforlicensedetails.
#include<USBSabertooth.h>
//ThisexampletreatsthepoweroutputsP1andP2
ascontrollableoutputs,
//usefulforfans,lights,single-direction
motors,etc.
//
//Thepoweroutputsarenot,bydefault,
controllableoutputs.
//YouwillneedtousetheDEScribesoftware,
availableat
//http://www.dimensionengineering.com/describe
//Toconfigurethem,inDEScribe,
//(1)ConnectandDownloadSettings,
//(2)OnthePowerOutputstab,setModeto
'ControllableOutput',andthen
//(3)UploadSettingstoDevice
//Thissamplewillthenwork.
USBSabertoothSerialC;//UsetheArduinoTXpin.
ItconnectstoS1.
//SeetheSoftwareSerialexamplein3.Advanced
forhowtouseotherpins.
USBSabertoothST(C,128);//TheUSBSabertoothis
onaddress128(unlessyou'vechangeditwith
DEScribe).
//We'llnameitsobjectST.
//
//Ifyou'vesetupyourSabertoothonadifferent
address,ofcoursechange
//thathere.ForhowtoconfiguretheSabertooth,
seetheDIPSwitchWizardat
//
http://www.dimensionengineering.com/datasheets/
USBSabertoothDIPWizard/start.htm
//BesuretoselectPacketSerialModeforuse
withthislibrary.
voidsetup()
{
SabertoothTXPinSerial.begin(9600);
}
voidloop()
{
intvalue;
//Ramppoweroutput1from-2047to2047(offto
fullpower),
//waiting20ms(1/50thofasecond)perstep.
for(value=-2047;value<=2047;value+=16)
{
ST.power(1,value);
delay(20);
}
//Nowgobackthewaywecame.
for(value=2047;value>=-2047;value-=16)
{
ST.power(1,value);//Tip:Typing
ST.power(value)doesthesamethingas
ST.power(1,value).
delay(20);//Ifyouoftenuse
onlyonepoweroutput,thisalternativecan
saveyoutyping.
}
}
MainPage Classes Files Examples
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
1.Basics/Simplest/Simplest.ino
Goesinonedirection,stops,andthengoesintheotherdirection.
//SimplestSampleforUSBSabertoothPacketSerial
//Copyright(c)2012-2013DimensionEngineering
LLC
//Seelicense.txtforlicensedetails.
#include<USBSabertooth.h>
USBSabertoothSerialC;//UsetheArduinoTXpin.
ItconnectstoS1.
//SeetheSoftwareSerialexamplein3.Advanced
forhowtouseotherpins.
USBSabertoothST(C,128);//TheUSBSabertoothis
onaddress128(unlessyou'vechangeditwith
DEScribe).
//We'llnameitsobjectST.
//
//Ifyou'vesetupyourSabertoothonadifferent
address,ofcoursechange
//thathere.ForhowtoconfiguretheSabertooth,
seetheDIPSwitchWizardat
//
http://www.dimensionengineering.com/datasheets/
USBSabertoothDIPWizard/start.htm
//BesuretoselectPacketSerialModeforuse
withthislibrary.
//
//TheUSBSabertoothlibraryexposesfeaturesthat
onlyexistonUSB-enabledSabertoothmotor
drivers,suchas
//12-bitmotoroutputs,poweroutputs,control
overfreewheeling,motorcurrentread-back,and
UserModevariables.
//Ifyoudonotneedthesefeatures,andwant
yourcodetobecompatiblewithall
Sabertooth/SyRenmotordrivers,
//includingthosethatarenotUSB-enabled,use
theSabertoothlibraryinstead.
voidsetup()
{
SabertoothTXPinSerial.begin(9600);//9600isthe
defaultbaudrateforSabertoothPacketSerial.
//YoucanchangethiswiththeDEScribesoftware,
availableat
//http://www.dimensionengineering.com/describe
}
voidloop()
{
ST.motor(1,2047);//Goforwardatfullpower.
delay(2000);//Wait2seconds.
ST.motor(1,0);//Stop.
delay(2000);//Wait2seconds.
ST.motor(1,-2047);//Reverseatfullpower.
delay(2000);//Wait2seconds.
ST.motor(1,0);//Stop.
delay(2000);
}
MainPage Classes Files Examples
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
1.Basics/Sweep/Sweep.ino
Sweepsfromfullreversetofullforwardandthenfromfullforwardtofullreverse.
//SweepSampleforUSBSabertoothPacketSerial
//Copyright(c)2012-2013DimensionEngineering
LLC
//Seelicense.txtforlicensedetails.
#include<USBSabertooth.h>
USBSabertoothSerialC;//UsetheArduinoTXpin.
ItconnectstoS1.
//SeetheSoftwareSerialexamplein3.Advanced
forhowtouseotherpins.
USBSabertoothST(C,128);//TheUSBSabertoothis
onaddress128(unlessyou'vechangeditwith
DEScribe).
//We'llnameitsobjectST.
//
//Ifyou'vesetupyourSabertoothonadifferent
address,ofcoursechange
//thathere.ForhowtoconfiguretheSabertooth,
seetheDIPSwitchWizardat
//
http://www.dimensionengineering.com/datasheets/
USBSabertoothDIPWizard/start.htm
//BesuretoselectPacketSerialModeforuse
withthislibrary.
//
//TheUSBSabertoothlibraryexposesfeaturesthat
onlyexistonUSB-enabledSabertoothmotor
drivers,suchas
//12-bitmotoroutputs,poweroutputs,control
overfreewheeling,motorcurrentread-back,and
UserModevariables.
//Ifyoudonotneedthesefeatures,andwant
yourcodetobecompatiblewithall
Sabertooth/SyRenmotordrivers,
//includingthosethatarenotUSB-enabled,use
theSabertoothlibraryinstead.
voidsetup()
{
SabertoothTXPinSerial.begin(9600);//9600isthe
defaultbaudrateforSabertoothPacketSerial.
//YoucanchangethiswiththeDEScribesoftware,
availableat
//http://www.dimensionengineering.com/describe
}
voidloop()
{
intpower;
//Rampmotor1from-2047to2047(fullreverse
tofullforward),
//waiting20ms(1/50thofasecond)perstep.
for(power=-2047;power<=2047;power+=16)
{
ST.motor(1,power);
delay(20);
}
//Nowgobackthewaywecame.
for(power=2047;power>=-2047;power-=16)
{
ST.motor(1,power);//Tip:Typing
ST.motor(power)doesthesamethingas
ST.motor(1,power).
delay(20);//Ifyouoftenuse
onlyonemotor,thisalternativecansaveyou
typing.
}
}
MainPage Classes Files Examples
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
1.Basics/TankStyleSweep/TankStyleSweep.ino
Sweepsvariousrangesinmixed(rover)mode.
//Tank-Style(Diff-Drive)SweepSampleforUSB
SabertoothPacketSerial
//Copyright(c)2012-2013DimensionEngineering
LLC
//Seelicense.txtforlicensedetails.
#include<USBSabertooth.h>
USBSabertoothSerialC;//UsetheArduinoTXpin.
ItconnectstoS1.
//SeetheSoftwareSerialexamplein3.Advanced
forhowtouseotherpins.
USBSabertoothST(C,128);//TheUSBSabertoothis
onaddress128(unlessyou'vechangeditwith
DEScribe).
//We'llnameitsobjectST.
//
//Ifyou'vesetupyourSabertoothonadifferent
address,ofcoursechange
//thathere.ForhowtoconfiguretheSabertooth,
seetheDIPSwitchWizardat
//
http://www.dimensionengineering.com/datasheets/
USBSabertoothDIPWizard/start.htm
//BesuretoselectPacketSerialModeforuse
withthislibrary.
//
//TheUSBSabertoothlibraryexposesfeaturesthat
onlyexistonUSB-enabledSabertoothmotor
drivers,suchas
//12-bitmotoroutputs,poweroutputs,control
overfreewheeling,motorcurrentread-back,and
UserModevariables.
//Ifyoudonotneedthesefeatures,andwant
yourcodetobecompatiblewithall
Sabertooth/SyRenmotordrivers,
//includingthosethatarenotUSB-enabled,use
theSabertoothlibraryinstead.
voidsetup()
{
SabertoothTXPinSerial.begin(9600);//9600isthe
defaultbaudrateforSabertoothPacketSerial.
//YoucanchangethiswiththeDEScribesoftware,
availableat
//http://www.dimensionengineering.com/describe
ST.drive(0);//TheSabertoothwon'tactonmixed
modepacketserialcommandsuntil
ST.turn(0);//ithasreceivedpowerlevelsfor
BOTHthrottleandturning,sinceit
//mixesthetwotogethertogetdiff-drivepower
levelsforbothmotors.
}
//TheSLOWramphereisturning,andtheFASTramp
isthrottle.
//Ifthat'stheoppositeofwhatyou'reseeing,
swapM2AandM2B.
voidloop()
{
intpower;
//Don'tturn.Rampfromgoingbackwardstogoing
forwards,waiting20ms(1/50thofasecond)
perstepof16.
for(power=-2047;power<=2047;power+=16)
{
ST.drive(power);
delay(20);
}
//Now,let'suseapowerlevelof400(outof
2047)forward.
//Thisway,ourturningwillhavearadius.
ST.drive(400);
//Rampturningfromfulllefttofullright
SLOWLYbywaiting20ms(1/50thofasecond)
perstepof4.
for(power=-2047;power<=2047;power+=4)
{
ST.turn(power);
delay(20);
}
//Nowstopturning,andstopdriving.
ST.turn(0);
ST.drive(0);
//Waitabit.Thisissoyoucancatchyourrobot
ifyouwantto.:-)
delay(5000);
}
MainPage Classes Files Examples
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
2.Settings/Ramping/Ramping.ino
Modifiestheramptime.
//SetRampingSampleforUSBSabertoothPacket
Serial
//Copyright(c)2012-2013DimensionEngineering
LLC
//Seelicense.txtforlicensedetails.
#include<USBSabertooth.h>
USBSabertoothSerialC;
USBSabertoothST(C,128);
voidsetup()
{
SabertoothTXPinSerial.begin(9600);
//Rampingvaluesrunfrom-16383(fast)to2047
(slow).
//-16383isequivalenttoturningofframping.
ST.setRamping(1980);//(approximately2seconds)
}
voidloop()
{
//Fullforward,bothmotors.
ST.motor(1,2047);
ST.motor(2,2047);
delay(5000);
//Fullreverse
ST.motor(1,-2047);
ST.motor(2,-2047);
delay(5000);
}
MainPage Classes Files Examples
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
2.Settings/SerialTimeout/SerialTimeout.ino
Setsaserialtimeout,andthendelaystodemonstrateitsstoppingbehavior.
//SetSerialTimeoutSampleforUSBSabertooth
PacketSerial
//Copyright(c)2012-2013DimensionEngineering
LLC
//Seelicense.txtforlicensedetails.
#include<USBSabertooth.h>
USBSabertoothSerialC;
USBSabertoothST(C,128);
voidsetup()
{
SabertoothTXPinSerial.begin(9600);
//Setatimeoutof1500mshere.
//Avalueof0resetstheserialtimeouttoits
default(normally,disabled).
//Youcanalsosettheserialtimeoutin
DEScribe,availableat
//http://www.dimensionengineering.com/describe
ST.setTimeout(1500);
}
voidloop()
{
//Setmotor1toreverse400(outof2047),and
sleepfor5seconds.
//Noticehowitcutsoutafter1.5seconds--
thisistheserialtimeoutinaction.
//Sinceweconfigureditinsetup()for1.5
second,1.5secondwithoutanynew
//commandswillcausethemotorstostop.
ST.motor(1,-400);
delay(5000);
//Whydothis?
//Ifyourprogramcrashes,orthesignalwireis
notworkingproperly,
//theSabertoothwillstopreceivingcommands
fromtheArduino.
//Withatimeout,yourrobotwillstop.
//
//So,serialtimeoutisprimarilyasafety
feature.Thatbeingthecase,
//it'sbesttosettheserialtimeoutinDEScribe
ifyoucan--ifthe
//signallineisnoisywhenthecommandissent,
itmaybelost.DEScribe
//settingsaresavedonthemotordriver,
eliminatingthatpossibility.
}
MainPage Classes Files Examples
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
3.Advanced/Checksum/Checksum.ino
ChangesfromCRCtoChecksummode.
//ChecksumSampleforUSBSabertoothPacketSerial
//Copyright(c)2012-2013DimensionEngineering
LLC
//Seelicense.txtforlicensedetails.
#include<USBSabertooth.h>
//Thissamplechangesthetypeoferrordetection
thatisdone.
//Ituseschecksumstoachieveafasterupdate
ratethantheSweepsample.
//
//Thetradeoffsareasfollows:
//|Checksum
|CRC|
//|-----------------------------------|-----------
-|-----------|
//|CommandSize|8bytes
|10bytes|
//|MaxCommandRateat9600Baud|120cmd/s
|96cmd/s|
//|DetectableBitFlips(Worst-Case)|1(HD=2)
|5(HD=6)|
//|-----------------------------------|-----------
-|-----------|
//
//Ifyouwantto,youcanrequiretheuseofCRC-
protectedcommands
//withDEScribe.GotoDEScribe'sSerialtabto
findthisoption.
//
//Thistabalsoletsyouchangetheserialbaud
rate.Increasingthe
//baudrateis,inmostsituations,abetterway
toincreasethemax
//commandratethanweakeningerrordetection.
USBSabertoothSerialC;
USBSabertoothST(C,128);
voidsetup()
{
SabertoothTXPinSerial.begin(9600);
ST.useChecksum();//ST.useCRC();isthedefault.
}
voidloop()
{
intpower;
//Rampmotor1from-2047to2047(fullreverse
tofullforward),
//waiting9ms(1/111thofasecond)perstep.
for(power=-2047;power<=2047;power+=8)
{
ST.motor(1,power);
delay(9);
}
//Nowgobackthewaywecame.
for(power=2047;power>=-2047;power-=8)
{
ST.motor(1,power);
delay(9);
}
}
MainPage Classes Files Examples
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
3.Advanced/SharedLine/SharedLine.ino
CommunicateswiththreeSabertoothmotordriversusingasharedTX/S1wire.
//SharedLineSampleforUSBSabertoothPacket
Serial
//Copyright(c)2012-2013DimensionEngineering
LLC
//Seelicense.txtforlicensedetails.
#include<USBSabertooth.h>
//Upto8Sabertooth/SyRenmotordriverscanshare
thesameS1line.
//Thissampleusesthree:address128and129on
ST1[0]andST1[2],
//andaddress130onST2.
//
//TochangetheaddressofaUSBSabertoothmotor
driver,gotothe
//SerialtabinDEScribe.DEScribecanbe
downloadedfrom
//http://www.dimensionengineering.com/describe
USBSabertoothSerialC;
USBSabertoothST1[2]={USBSabertooth(C,
128),USBSabertooth(C,129)};
USBSabertoothST2(C,130);
voidsetup()
{
SabertoothTXPinSerial.begin(9600);
}
voidloop()
{
//ST1[0](address128)haspower800(of2047
max)onM1,
//ST1[1](address129)haspower1000(of2047
max)onM2,and
//ST2(address130)we'lldotank-styleand
haveitdrive300andturnright800.
//Dothisfor5seconds.
ST1[0].motor(1,800);
ST1[1].motor(2,1000);
ST2.drive(300);
ST2.turn(800);
delay(5000);
//Andnowlet'sstopfor5seconds,except
address130--we'llletitstopandturn
left...
ST1[0].motor(1,0);
ST1[1].motor(2,0);
ST2.drive(0);
ST2.turn(-600);
delay(5000);
}
MainPage Classes Files Examples
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
3.Advanced/SoftwareSerial/SoftwareSerial.ino
UsesapinotherthanTXtoconnecttoS1.
//SoftwareSerialSampleforUSBSabertoothPacket
Serial
//Copyright(c)2012-2013DimensionEngineering
LLC
//Seelicense.txtforlicensedetails.
#include<SoftwareSerial.h>
#include<USBSabertooth.h>
SoftwareSerialSWSerial(NOT_A_PIN,11);//RX
onnopin(unused),TXonpin11(toS1).
USBSabertoothSerialC(SWSerial);//Use
SWSerialastheserialport.
USBSabertoothST(C,128);//Use
address128.
voidsetup()
{
SWSerial.begin(9600);
}
voidloop()
{
intpower;
//Rampmotor1from-2047to2047(fullreverse
tofullforward),
//waiting20ms(1/50thofasecond)perstep.
for(power=-2047;power<=2047;power+=16)
{
ST.motor(1,power);
delay(20);
}
//Nowgobackthewaywecame.
for(power=2047;power>=-2047;power-=16)
{
ST.motor(1,power);
delay(20);
}
}
MainPage Classes Files ExamplesClassList ClassIndex ClassMembers
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
USBSabertoothMemberList
ThisisthecompletelistofmembersforUSBSabertooth,includingallinheritedmembers.
address()constcommand(bytecommand,bytevalue)command(bytecommand,constbyte*value,size_tbytes)drive(intvalue)freewheel(intvalue=2048)freewheel(bytemotorOutputNumber,intvalue=2048)get(bytetype,bytenumber)getBattery(bytemotorOutputNumber,booleanunscaled=false)getCurrent(bytemotorOutputNumber,booleanunscaled=false)getGetRetryInterval()constgetGetTimeout()constgetTemperature(bytemotorOutputNumber,booleanunscaled=false)keepAlive()motor(intvalue)motor(bytemotorOutputNumber,intvalue)power(intvalue)power(bytepowerOutputNumber,intvalue)
set(bytetype,bytenumber,intvalue)setGetRetryInterval(int32_tintervalMS)setGetTimeout(int32_ttimeoutMS)setRamping(intvalue)setRamping(bytemotorOutputNumber,intvalue)setTimeout(intmilliseconds)shutDown(bytetype,bytenumber,booleanvalue=true)turn(intvalue)USBSabertooth(USBSabertoothSerial&serial,byteaddress)useChecksum()useCRC()usingCRC()const
MainPage Classes Files ExamplesClassList ClassIndex ClassMembers
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
USBSabertoothSerialMemberList
ThisisthecompletelistofmembersforUSBSabertoothSerial,includingallinheritedmembers.
port()USBSabertoothSerial(Stream&port=SabertoothTXPinSerial)
MainPage Classes Files ExamplesFileList
USBSabertooth
USBSabertoothPacketSerialLibraryforArduinoControlyourUSB-enabledSabertoothwithreliablePacketSerial.
USBSabertooth.h
Gotothedocumentationofthisfile.1 /*
2 ArduinoLibraryforUSBSabertoothPacket
Serial
3 Copyright(c)2013DimensionEngineeringLLC
4 http://www.dimensionengineering.com/arduino
5
6 Permissiontouse,copy,modify,and/or
distributethissoftwareforany
7 purposewithorwithoutfeeishereby
granted,providedthattheabove
8 copyrightnoticeandthispermissionnotice
appearinallcopies.
9
10 THESOFTWAREISPROVIDED"ASIS"ANDTHE
AUTHORDISCLAIMSALLWARRANTIES
11 WITHREGARDTOTHISSOFTWAREINCLUDINGALL
IMPLIEDWARRANTIESOF
12 MERCHANTABILITYANDFITNESS.INNOEVENT
SHALLTHEAUTHORBELIABLEFORANY
13 SPECIAL,DIRECT,INDIRECT,ORCONSEQUENTIAL
DAMAGESORANYDAMAGESWHATSOEVER
14 RESULTINGFROMLOSSOFUSE,DATAORPROFITS,
WHETHERINANACTIONOFCONTRACT,
15 NEGLIGENCEOROTHERTORTIOUSACTION,ARISING
OUTOFORINCONNECTIONWITHTHE
16 USEORPERFORMANCEOFTHISSOFTWARE.
17 */
18
19 #ifndefUSBSabertooth_h
20 #defineUSBSabertooth_h
21
27 #ifdefined(ARDUINO)&&ARDUINO<100
28 #error"ThislibraryrequiresArduino1.0or
newer."
29 #endif
30
31 #include<Arduino.h>
32
33 #ifdefined(USBCON)
34 #defineSabertoothTXPinSerialSerial1//
ArduinoLeonardohasTX->1onSerial1,not
Serial.
35 #else
36 #defineSabertoothTXPinSerialSerial
37 #endif
38 #defineSyRenTXPinSerial
SabertoothTXPinSerial
39
40 #defineSABERTOOTH_COMMAND_MAX_BUFFER_LENGTH
10
41 #defineSABERTOOTH_COMMAND_MAX_DATA_LENGTH
5
42 #defineSABERTOOTH_DEFAULT_GET_RETRY_INTERVAL
100
43 #defineSABERTOOTH_DEFAULT_GET_TIMEOUT
SABERTOOTH_INFINITE_TIMEOUT
44 #defineSABERTOOTH_GET_TIMED_OUT
-32768
45 #defineSABERTOOTH_INFINITE_TIMEOUT
-1
46 #defineSABERTOOTH_MAX_VALUE
16383
47
48 enumUSBSabertoothCommand
49 {
50 SABERTOOTH_CMD_SET=40,
51 SABERTOOTH_CMD_GET=41,
52 };
53
54 enumUSBSabertoothReplyCode
55 {
56 SABERTOOTH_RC_GET=73
57 };
58
59 enumUSBSabertoothGetType
60 {
61 SABERTOOTH_GET_VALUE=0x00,
62 SABERTOOTH_GET_BATTERY=0x10,
63 SABERTOOTH_GET_CURRENT=0x20,
64 SABERTOOTH_GET_TEMPERATURE=0x40
65 };
66
67 enumUSBSabertoothSetType
68 {
69 SABERTOOTH_SET_VALUE=0x00,
70 SABERTOOTH_SET_KEEPALIVE=0x10,
71 SABERTOOTH_SET_SHUTDOWN=0x20,
72 SABERTOOTH_SET_TIMEOUT=0x40
73 };
74
75 classUSBSabertoothCommandWriter
76 {
77 public:
78 staticsize_twriteToBuffer(byte*buffer,
byteaddress,USBSabertoothCommandcommand,
booleanuseCRC,constbyte*data,size_t
lengthOfData);
79 staticvoidwriteToStream(Stream&port,
byteaddress,USBSabertoothCommandcommand,
booleanuseCRC,constbyte*data,size_t
lengthOfData);
80 };
81
82 classUSBSabertoothChecksum
83 {
84 public:
85 staticbytevalue(constbyte*data,size_t
lengthOfData);
86 };
87
88 classUSBSabertoothCRC7
89 {
90 public:
91 voidbegin();
92 voidwrite(bytedata);
93 voidwrite(constbyte*data,size_t
lengthOfData);
94 voidend();
95
96 public:
97 inlinebytevalue()const{return_crc;
}
98 voidvalue(bytecrc){_crc=crc;
}
99
100 staticbytevalue(constbyte*data,size_t
lengthOfData);
101
102 private:
103 byte_crc;
104 };
105
106 classUSBSabertoothCRC14
107 {
108 public:
109 voidbegin();
110 voidwrite(bytedata);
111 voidwrite(constbyte*data,size_t
lengthOfData);
112 voidend();
113
114 public:
115 inlineuint16_tvalue()const{
return_crc;}
116 voidvalue(uint16_tcrc){_crc
=crc;}
117
118 staticuint16_tvalue(constbyte*data,
size_tlengthOfData);
119
120 private:
121 uint16_t_crc;
122 };
123
124 classUSBSabertoothReplyReceiver
125 {
126 public:
127 USBSabertoothReplyReceiver();
128
129 public:
130 inlinebyteaddress
()const{return_data[0];
}
131 inlineUSBSabertoothReplyCodecommand
()const{return
(USBSabertoothReplyCode)_data[1];}
132 inlineconstbyte*data
()const{return_data;
}
133 inlinebooleanusingCRC()
const{return_usingCRC;
}
134
135 public:
136 inlinebooleanready()const{return
_ready;}
137 voidread(bytedata);
138 voidreset();
139
140 private:
141 byte
_data[SABERTOOTH_COMMAND_MAX_BUFFER_LENGTH];
142 size_t_length;boolean_ready,_usingCRC;
143 };
144
145 classUSBSabertoothTimeout
146 {
147 public:
148 USBSabertoothTimeout(int32_ttimeoutMS);
149
150 public:
151 booleancanExpire()const;
152
153 booleanexpired()const;
154
155 voidexpire();
156
157 voidreset();
158
159 private:
160 uint32_t_start;
161 int32_t_timeoutMS;
162 };
163
169 classUSBSabertoothSerial
170 {
171 friendclassUSBSabertooth;
172
173 public:
179 USBSabertoothSerial(Stream&port=
SabertoothTXPinSerial);
180
181 public:
186 inlineStream&port(){return_port;}
187
188 private:
189 booleantryReceivePacket();
190
191 private:
192 USBSabertoothSerial(USBSabertoothSerial&
serial);//nocopy
193 voidoperator=(USBSabertoothSerial&
serial);
194
195 private:
196 USBSabertoothReplyReceiver_receiver;
197 Stream&_port;
198 };
199
204 classUSBSabertooth
205 {
206 public:
213 USBSabertooth(USBSabertoothSerial&serial,
byteaddress);
214
215 public:
220 inlinebyteaddress()const{return
_address;}
221
227 voidcommand(bytecommand,bytevalue);
228
235 voidcommand(bytecommand,constbyte*
value,size_tbytes);
236
237 public:
243 voidmotor(intvalue);
244
253 voidmotor(bytemotorOutputNumber,int
value);
254
260 voidpower(intvalue);
261
270 voidpower(bytepowerOutputNumber,int
value);
271
277 voiddrive(intvalue);
278
284 voidturn(intvalue);
285
292 voidfreewheel(intvalue=2048);
293
303 voidfreewheel(bytemotorOutputNumber,int
value=2048);
304
316 voidshutDown(bytetype,bytenumber,
booleanvalue=true);
317
318 public:
332 voidset(bytetype,bytenumber,int
value);
333
339 voidsetRamping(intvalue);
340
349 voidsetRamping(bytemotorOutputNumber,int
value);
350
359 voidsetTimeout(intmilliseconds);
360
366 voidkeepAlive();
367
368 public:
381 inlineintget(bytetype,bytenumber)
382 {
383 returnget(type,number,
SABERTOOTH_GET_VALUE,false);
384 }
385
394 inlineintgetBattery(byte
motorOutputNumber,booleanunscaled=false)
395 {
396 returnget('M',motorOutputNumber,
SABERTOOTH_GET_BATTERY,unscaled);
397 }
398
407 inlineintgetCurrent(byte
motorOutputNumber,booleanunscaled=false)
408 {
409 returnget('M',motorOutputNumber,
SABERTOOTH_GET_CURRENT,unscaled);
410 }
411
420 inlineintgetTemperature(byte
motorOutputNumber,booleanunscaled=false)
421 {
422 returnget('M',motorOutputNumber,
SABERTOOTH_GET_TEMPERATURE,unscaled);
423 }
424
425 public:
429 inlineint32_tgetGetRetryInterval()const
{return_getRetryInterval;}
430
435 inlinevoidsetGetRetryInterval(int32_t
intervalMS){_getRetryInterval=intervalMS;}
436
441 inlineint32_tgetGetTimeout()const{
return_getTimeout;}
442
447 inlinevoidsetGetTimeout(int32_t
timeoutMS){_getTimeout=timeoutMS;}
448
453 inlinebooleanusingCRC()const{return
_crc;}
454
458 inlinevoiduseChecksum(){_crc=false;}
459
463 inlinevoiduseCRC(){_crc=true;}
464
465 private:
466 intget(bytetype,bytenumber,
467 USBSabertoothGetTypegetType,
booleanraw);
468
469 voidset(bytetype,bytenumber,intvalue,
470 USBSabertoothSetTypesetType);
471
472 private:
473 voidinit();
474
475 private:
476 constbyte_address;
477 boolean_crc;
478 int32_t_getRetryInterval;
479 int32_t_getTimeout;
480 USBSabertoothSerial&_serial;
481 };
482
483 #endif