elbear_arduino_bsp/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino
klassents 0fbfd77518 v0.5.3
- начальный загрузчик для плат elbear, elsomik обновлен до версии 0.2.0
- исключено появление краткосрочных просадок при работе ШИМ с максимальным коэффициентом заполнения
- добавлена возможность пропускать код стандартного обработчика прерываний при использовании пользовательского обработчика
- добавлена возможность конфигурирования вывода на вход с притяжкой к земле (INPUT_PULLDOWN)
- исправление известных ошибок
2025-08-06 08:42:39 +03:00

50 lines
1.4 KiB
C++

/*
Software serial multiple serial test
Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial.
The circuit:
* RX is digital pin 2 (P0_10) (connect to TX of other device)
* TX is digital pin 6 (P0_2) (connect to RX of other device)
Note:
Not all pins on the Elbear Ace-Uno/Ace-Nano support interrupts,
so only the following can be used for RX: 2, 3, 4, 5, 8, 9
Elsomik board pins with interrupts: P0_8, P1_4, P1_5, P1_6, P1_9, P1_10, P1_15, P2_7
Start board pins with interrupts: P0_10, P0_12, P0_13, P0_14, P0_15, P1_9, P1_15
created back in the mists of time
modified 25 May 2012
by Tom Igoe
based on Mikal Hart's example
This example code is in the public domain.
*/
#include <SoftwareSerial.h>
int rx_pin = 2; // P1_9 for Start/Elsomik
int tx_pin = 6; // P0_2 for Start/Elsomik
SoftwareSerial mySerial(rx_pin, tx_pin);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) ; // wait for serial port to connect. Needed for native USB port only
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println("Hello, world?");
}
void loop() { // run over and over
while (mySerial.available())
Serial.write(mySerial.read());
while (Serial.available())
mySerial.write(Serial.read());
delay(50);
}