/*ProMicroTestCode
by:NathanSeidle
modifiedby:JimLindblom
SparkFunElectronics
date:September 16,2013
license:PublicDomainpleaseusethiscodehoweveryo
u'dlike.
It'sprovidedasalearningtool.
ThiscodeisprovidedtoshowhowtocontroltheSparkFun
ProMicro'sTXandRX
LEDswithinasketch.Italsoserves
toexplainthedifferencebetweenSerial.print()and
Serial1.print().
*/
int RXLED=17;//TheRXLEDhasadefinedArduinopin
//TheTXLEDwasnotsolucky,we'llneedtousepredefined
//macros(TXLED1,TXLED0)tocontrolthat.
//(Wecoul
dusethesamemacrosfortheRXLEDtooRXLED1,
//andRXLED0.)
void setup()
{
pinMode(RXLED,OUTPUT);//SetRXLEDasanoutput
//TXLEDissetasanoutputbehindthescenes
Serial.begin(9600);//Thispipestotheserialmonitor
Serial1.begin(9600);//ThisistheUART,pipestosensorsatt
achedtobo
ard
}
void loop()
{
Serial.println("Helloworld");//Print"Hel loWorld"toth
eSerialMonitor
Serial1.println("Hello!");//Print"Hello!"overhardwareU
ART
digitalWrite(RXLED,LOW);//settheLEDon
TXLED0;//TXLEDisnottiedtoanorm allycontrolledpin
delay(1000);//waitforasecond
digitalWrite(RXLED,HIGH);//settheLEDoff
TXL
ED1;
delay(1000);//waitforasecond
}
Page 1
of 2