Mega 2560 und serielle Schnittstelle

Hallo,
die "SoftwareSerial" stellt doch nur weitere Pin´s für die serielle Kommuni-
kation bereit?
Wenn ich einen Mega 2560 nutze, dann brauche ich diese doch nicht zwingend?

Ich habe nachfolgendes:

#include "SoftwareSerial.h"

SoftwareSerial K_30_Serial(12,13);  //Sets up a virtual serial port
                                    //Using pin 12 for Rx and pin 13 for Tx


byte readCO2[] = {0xFE, 0X44, 0X00, 0X08, 0X02, 0X9F, 0X25};  //Command packet to read Co2 (see app note)
byte response[] = {0,0,0,0,0,0,0};  //create an array to store the response

//multiplier for value. default is 1. set to 3 for K-30 3% and 10 for K-33 ICB
int valMultiplier = 1;

void setup() 
{
  // put your setup code here, to run once:
  Serial.begin(9600);         //Opens the main serial port to communicate with the computer
  K_30_Serial.begin(9600);    //Opens the virtual serial port with a baud of 9600
}

hier legt die "SoftwareSerial" die Pin´s 12 & 13 für die serielle Kommuni-
kation fest.

SoftwareSerial K_30_Serial(12,13);  //Sets up a virtual serial port
                                    //Using pin 12 for Rx and pin 13 for Tx

Ich kann doch aber auch statt

K_30_Serial.begin(9600);    //Opens the virtual serial port with a baud of 9600

einfach

K_30_Serial1.begin(9600);    //RX1 & TX1 auf 9600 Baud

verwenden?

Gruß und Dank
Andreas

Ja! "The Arduino Mega has three additional serial ports: Serial1 on pins 19 (RX) and 18 (TX), Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX)."

Es gibt zusätzlich 1, 2 und 3 :slight_smile:

K_30_Serial1.begin(9600);    //RX1 & TX1 auf 9600 Baud

Ich glaube Nein

Serial1.begin(9600);    //RX1 & TX1 auf 9600 Baud
Müßte richtig sein.

Grüße Uwe

Hallo,
schönen Dank dafür.
Gruß und Spaß
Andreas