Hello everyone, I need that a Sparkfun pro micro (master) send a message via serial with a nano 33 iot (slave).
I thought to use the SoftwareSerial library but on the nano 33 iot it's not possible, searching on the web I read that you have to use "wiring_private.h" with SERCOM0_Handler().
I connected the tx pin of the pro micro to the 5 of the nano, the rx of the pro micro to the 6 of the nano and the two gnd
this is the code I loaded on the nano 33 iot
/*
Ho collegato il pin tx dello sparkfun pro micro al pin 5 del nano 33 iot e l'rx del pro micro al pin 6 del 33 iot
*/
#include <Arduino.h>
#include "wiring_private.h"
Uart mySerial (&sercom0, 5, 6, SERCOM_RX_PAD_1, UART_TX_PAD_0);
// Attach the interrupt handler to the SERCOM
void SERCOM0_Handler()
{
mySerial.IrqHandler();
}
void setup() {
// Reassign pins 5 and 6 to SERCOM alt
pinPeripheral(5, PIO_SERCOM_ALT);
pinPeripheral(6, PIO_SERCOM_ALT);
// Start my new hardware serial
mySerial.begin(9600);
Serial.begin(9600);
}
void loop() {
if (mySerial.available()){
//ricevo un carattere dalla seriale software
//lo scrivo sulla seriale vera, collegata al pc
Serial.write(mySerial.read());
}
But unfortunately I don't read anything on the serial!
I have the doubt that I should use the void SERCOM0_Handler(), but how?
Thanks