EasyManua.ls Logo

sparkfun Pro Micro - Page 16

sparkfun Pro Micro
27 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
/*ProMicroTestCode
by:NathanSeidle
modifiedby:JimLindblom
SparkFunElectronics
date:September 16,2013
license:PublicDomainpleaseusethiscodehoweveryo
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
dusethesamemacrosfortheRXLEDtooRXLED1,
//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
6
of 2
7

Related product manuals