Skip to content

Commit da288c0

Browse files
committed
Update Serial.ino
1 parent 240dcd8 commit da288c0

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

libraries/Apollo3/examples/Serial/Serial.ino

+22-9
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
*/
3030

3131
/*
32+
Apollo3 UART pad mapping
33+
3234
uart0 | | uart1
3335
---------------------------------------------
3436
tx | rx | rts | cts | | tx | rx | rts | cts
@@ -48,25 +50,36 @@
4850
| | 47
4951
*/
5052

51-
//// uncomment to use these names if defined for your board
52-
//// (these are also the pins used for Serial1, which is
53-
//// available on applicable boards)
54-
//#define HAS_SERIAL1
55-
//UART mySerial(SERIAL1_TX, SERIAL1_RX);
53+
// uncomment to define SERIAL1_TX and SERIAL1_RX as custom pin numbers in case they
54+
// are not defined by default (look up the correct pad <--> pin mapping for your board
55+
#define SERIAL1_TX 35
56+
#define SERIAL1_RX 13
57+
58+
// uncomment to use these names if defined for your board
59+
// (these are also the pins used for Serial1, which is
60+
// available on applicable boards)
61+
#define HAS_SERIAL1
62+
UART mySerial(SERIAL1_TX, SERIAL1_RX);
5663

5764
#define BAUD 115200 // any number, common choices: 9600, 115200, 230400, 921600
5865
#define CONFIG SERIAL_8N1 // a config value from HardwareSerial.h (defaults to SERIAL_8N1)
5966

6067
void setup() {
6168
Serial.begin(BAUD); // set the baud rate with the begin() method
62-
Serial.println("Apollo3 = Serial");
63-
Serial.println("Echo Back Character");
69+
Serial.println("\n\nApollo3 - Serial");
70+
71+
// the Apollo3 core supports printf on Serial
72+
for (size_t idx = 0; idx < 10; idx++){
73+
Serial.printf("printf supports printing formatted strings! count: %d\n", idx);
74+
}
75+
76+
Serial.println("\nEcho... (type characters into the Serial Monitor to see them echo back)\n");
6477

6578

6679
#ifdef HAS_SERIAL1
6780
mySerial.begin(BAUD, CONFIG); // specify the config setting as the secnd argument
68-
mySerial.println("Apollo3 = mySerial");
69-
mySerial.println("Echo Back Character");
81+
mySerial.println("\n\nApollo3 - mySerial");
82+
mySerial.println("\nEcho... (type characters into the Serial Monitor to see them echo back)\n");
7083
#endif
7184
}
7285

0 commit comments

Comments
 (0)