|
29 | 29 | */
|
30 | 30 |
|
31 | 31 | /*
|
| 32 | + Apollo3 UART pad mapping |
| 33 | +
|
32 | 34 | uart0 | | uart1
|
33 | 35 | ---------------------------------------------
|
34 | 36 | tx | rx | rts | cts | | tx | rx | rts | cts
|
|
48 | 50 | | | 47
|
49 | 51 | */
|
50 | 52 |
|
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); |
56 | 63 |
|
57 | 64 | #define BAUD 115200 // any number, common choices: 9600, 115200, 230400, 921600
|
58 | 65 | #define CONFIG SERIAL_8N1 // a config value from HardwareSerial.h (defaults to SERIAL_8N1)
|
59 | 66 |
|
60 | 67 | void setup() {
|
61 | 68 | 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"); |
64 | 77 |
|
65 | 78 |
|
66 | 79 | #ifdef HAS_SERIAL1
|
67 | 80 | 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"); |
70 | 83 | #endif
|
71 | 84 | }
|
72 | 85 |
|
|
0 commit comments