/* AnalogReadSerial on ne UART placed on pins 0 and 1 Reads an analog input on pin A0, prints the result to the serial monitor. Graphical representation is available using serial plotter (Tools > Serial Plotter menu) Attach the center pin of a potentiometer to pin A0, and the outside pins to +3.3V and ground. Short together pin 0 and pin 1 with a wire jumper Created 20 Jun 2016 by Arturo Guadalupi This example code is in the public domain. */ #include #include "wiring_private.h" Uart Serial2(&sercom1, 12, 10, SERCOM_RX_PAD_3, UART_TX_PAD_2); Uart Serial3(&sercom2, 3, 2, SERCOM_RX_PAD_1, UART_TX_PAD_2); //Uart Serial3(&sercom0, 3, 8, SERCOM_RX_PAD_1, UART_TX_PAD_2); // the setup routine runs once when you press reset: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); Serial1.begin(9600); Serial2.begin(9600); Serial3.begin(9600); pinPeripheral(12, PIO_SERCOM); //Assign RX function to pin 12 pinPeripheral(10, PIO_SERCOM); //Assign TX function to pin 10 // pinPeripheral(3, PIO_SERCOM_ALT); //Assign RX function to pin 3 // pinPeripheral(2, PIO_SERCOM); //Assign TX function to pin 2 pinPeripheral(3, PIO_SERCOM_ALT); //Assign RX function to pin 3 pinPeripheral(2, PIO_SERCOM); //Assign TX function to pin 2 } /* SERCOM_RX_PAD_0 = 0, SERCOM_RX_PAD_1, SERCOM_RX_PAD_2, SERCOM_RX_PAD_3 */ /* UART_TX_PAD_0 = 0x0ul, // Only for UART UART_TX_PAD_2 = 0x1ul, // Only for UART */ // the loop routine runs over and over again forever: void loop() { Serial1.println("Hola"); Serial2.println("Hiii"); Serial3.println("Yeah"); delay(10); // delay in between reads for stability while (Serial2.available()) { Serial.write(Serial2.read()); } while (Serial1.available()) { Serial.write(Serial1.read()); } while (Serial3.available()) { Serial.write(Serial3.read()); } //Serial.println(); //delay(10); // delay in between reads for stability } //// Attach the interrupt handler to the SERCOM void SERCOM1_Handler() { Serial2.IrqHandler(); } void SERCOM2_Handler() { Serial3.IrqHandler(); }