Library [better]: Softwareserial.h

void sendString(SoftwareSerial &ss, char *msg) ss.listen(); // Ensure we're not receiving delay(1); // Allow any pending RX to finish ss.print(msg);

Bidirectional Communication with Collision Avoidance Since SoftwareSerial is half-duplex, implement a simple protocol: softwareserial.h library

port1.listen(); // Switch back

// Switch to port2 briefly port2.listen(); if (port2.available()) // Process port2 data void sendString(SoftwareSerial &ss, char *msg) ss

1. Introduction: The Hardware Limitation Every Arduino enthusiast eventually hits the wall: "I only have one hardware serial port (pins 0 and 1), but I need to connect two serial devices." void sendString(SoftwareSerial &ss

// Must call listen() on active port regularly if (!gps.isListening()) gps.listen();

void loop() // Check GPS if (gps.available()) char c = gps.read(); Serial.print(c); // Show on debug bluetooth.print(c); // Forward to Bluetooth

softwareserial.h library
Subscribe
softwareserial.h library
EMAIL YOUR CUSTOMERS LOVE
Learn 4 Steps to Better Transactional Email for Your Online Store.
Yes, please
Mother's Day Sales & Deals
GET UPTO 70% OFF
Sale ends in
Subscribe Now