![]() ![]() Computer\AppData\Roaming\Arduino15\packages\arduino\hardware\samd\1.6.1\variants\arduino_zero\variant.cpp: // 44.45 - SERCOM2 Just dd the two following lines to the end of the "g_APinDescription" array in the file. Implementing Serial3 however, requires a modification to the "variant.cpp" file. Void SERCOM1_Handler() // Interrupt handler for SERCOM1 Serial2.write(byteRead) // Echo the byte back out on the serial port If (Serial2.available()) // Check if incoming data is availableīyte byteRead = Serial2.read() // Read the most recent byte Uart Serial2(&sercom1, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX) #define PAD_SERIAL2_RX (SERCOM_RX_PAD_3) // SERCOM pad 3 #define PAD_SERIAL2_TX (UART_TX_PAD_2) // SERCOM pad 2 #define PIN_SERIAL2_TX (36ul) // Pin description number for PIO_SERCOM on D10 #define PIN_SERIAL2_RX (34ul) // Pin description number for PIO_SERCOM on D12 This code example simply echos back characters sent from the Arduino IDE console: // Serial2 pin and pad definitions (in Arduino files Variant.h & Variant.cpp) If it's not there, it's possible to get Serial2 working on D12 (Rx) and D10 (Tx) without modification to the "variant" files, using the following code in your Arduino sketch. Yes, "variant.cpp"/"variant.h" are the places to look. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |