Skip to content

Conversation

@mike-matera
Copy link
Owner

This patch is tested on Uno using the default and a SoftwareSerial instance. Changing the serial port on Leonardo compiles but I is not tested.

This fixes bug #20

Would someone please help by testing their use case?

Here's an example that uses SoftwareSerial

#include <ArduinoSTL.h>
#include <SoftwareSerial.h>

SoftwareSerial mySerial(0, 1); // RX, TX (Hardware pins on Uno)

namespace std { 
  ohserialstream cout(mySerial);
  ihserialstream cin(mySerial);
}

void setup() {
  mySerial.begin(9600);
  ArduinoSTL_Serial.connect(mySerial);
}

void loop() {
  printf ("Hello ");
  std::cout << "World!" << std::endl;
}

@mike-matera mike-matera added the type: enhancement Proposed improvement label Apr 4, 2018
@neu-rah
Copy link

neu-rah commented Apr 4, 2018

works ok on nano (atmega328) and pro-mini (atmega32u4), it messes, as expected, with other boards like esp32, eps8266, nrf52, etc.. even if they support arduino framework and because stl is already available on those platforms.
keep up the good work 👍

@mike-matera
Copy link
Owner Author

Thanks! I'm going to merge this change.

@mike-matera mike-matera merged commit 4885bb3 into master Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement Proposed improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants