Using the sample code from https://learn.sparkfun.com/tutorials/qw … ng-further, the sample code for blinking the TX/RX leds did not send correct serial data out the external serial port (Tx/Rx lines). It looks like the data coming out is the wrong baud rate, although I have tried many different combinations of baud rates, and I am unable to find one where the outputted text is correct. The serial monitor works as expected.
My board is definitely a 5V variant (I saw this on another forum, where they found the devices were 3.3V instead of 5V.
/* Pro Micro Test Code
by: Nathan Seidle
modified by: Jim Lindblom
SparkFun Electronics
date: September 16, 2013
license: Public Domain - please use this code however you'd like.
It's provided as a learning tool.
This code is provided to show how to control the SparkFun
ProMicro's TX and RX LEDs within a sketch. It also serves
to explain the difference between Serial.print() and
Serial1.print().
*/
int RXLED = 17; // The RX LED has a defined Arduino pin
// Note: The TX LED was not so lucky, we'll need to use pre-defined
// macros (TXLED1, TXLED0) to control that.
// (We could use the same macros for the RX LED too -- RXLED1,
// and RXLED0.)
void setup()
{
pinMode(RXLED, OUTPUT); // Set RX LED as an output
// TX LED is set as an output behind the scenes
Serial.begin(9600); //This pipes to the serial monitor
delay(100); // wait for a second
Serial.println("Initialize Serial Monitor");
Serial1.begin(9600); //This is the UART, pipes to sensors attached to board
delay(100); // wait for a second
Serial1.println("Initialize Serial Hardware UART Pins");
}
void loop()
{
Serial.println("Hello world!"); // Print "Hello World" to the Serial Monitor
Serial1.println("Hello! Can anybody hear me?"); // Print "Hello!" over hardware UART
digitalWrite(RXLED, LOW); // set the RX LED ON
TXLED0; //TX LED is not tied to a normally controlled pin so a macro is needed, turn LED OFF
delay(1000); // wait for a second
digitalWrite(RXLED, HIGH); // set the RX LED OFF
TXLED1; //TX LED macro to turn LED ON
delay(1000); // wait for a second
}
I do have another serial-related post here, but this issue is completely different than the other. I am trying to get back to the basics to understand the issue.
Also, I noticed that unless I put a delay here:
Serial.begin(9600); //This pipes to the serial monitor
delay(100); // wait for a second
Serial.println("Initialize Serial Monitor");
That the data never gets sent to the monitor. Does this have something to do with the time it takes the USB virtual port setup to complete in Windows after the software is uploaded to the board?
TIA