NewSoftSerial

A New Software Serial Library for Arduino

News: NewSoftSerial is in the core!  Starting with Arduino 1.0 (December, 2011), NewSoftSerial has replaced the old SoftwareSerial library as the officially supported software serial library.  This means that if you have 1.0 or later, you should not download this library.  To port your code to 1.0, simply change all NewSoftSerial references to SoftwareSerial.

NewSoftSerial is the latest of three Arduino libraries providing “soft” serial port support. It’s the direct descendant of ladyada’s AFSoftSerial, which introduced interrupt-driven receives — a dramatic improvement over the polling required by the native SoftwareSerial.

Without interrupts, your program’s design is considerably restricted, as it must continually poll the serial port at very short, regular intervals. This makes it nearly impossible, for example, to use SoftwareSerial to receive GPS data and parse it into a usable form. Your program is too busy trying to keep up with NMEA characters as they arrive to actually spend time assembling them into something meaningful. This is where AFSoftSerial’s (and NewSoftSerial‘s) interrupt architecture is a godsend. Using interrupt-driven RX, your program fills its buffer behind the scenes while processing previously received data.

Improvements

NewSoftSerial offers a number of improvements over SoftwareSerial:

  1. It inherits from built-in class Print, eliminating some 4-600 bytes of duplicate code
  2. It implements circular buffering scheme to make RX processing more efficient
  3. It extends support to all Arduino pins 0-19 (0-21 on Arduino Mini), not just 0-13
  4. It supports multiple simultaneous soft serial devices.*
  5. It supports a much wider range of baud rates.**
  6. It provides a boolean overflow() method to detect buffer overflow.
  7. Higher baud rates have been tuned for better accuracy.
  8. It supports the ATMega328 and 168.
  9. It supports 8MHz processors.
  10. It uses direct port I/O for faster and more precise operation.
  11. (New with version 10).  It supports software signal inversion.
  12. (New) It supports 20MHz processors.
  13. (New) It runs on the Teensy and Teensy++.
  14. (New) It supports an end() method as a complement to begin().

*But see below for an important caveat on multiple instances.
**Be circumspect about using 300 and 1200 baud though. The interrupt handler at these rate becomes so lengthy that timer tick interrupts can be starved, causing millis() to stop working during receives.

Using Multiple Instances

There has been considerable support for an library that would allow multiple soft serial devices. However, handling asynchronously received data from two, three, or four or more serial devices turns out to be an extremely difficult, if not intractable problem. Imagine four serial devices connected to an Arduino, each transmitting at 38,400 baud. As bits arrive, Arduino’s poor little processor must sample and process each of 4 incoming bits within 26 microseconds or else lose them forever. Yikes!

It occurred to me, though, that multiple instances could still be possible if the library user were willing to make a small concession. NewSoftSerial is written on the principle that you can have as many devices connected as resource constraints allow, as long as you only use one of them at a time. If you can organize your program code around this constraint, then NewSoftSerial may work for you.

What does this mean, exactly? Well, you have to use your serial devices serially, like this:

#include <NewSoftSerial.h>

// Here's a GPS device connect to pins 3 and 4
NewSoftSerial gps(4,3);

// A serial thermometer connected to 5 and 6
NewSoftSerial therm(6,5);

// An LCD connected to 7 and 8
NewSoftSerial LCD(8,7); // serial LCD

void loop()
{
  ...
  // collect data from the GPS unit for a few seconds
  gps.listen();
  read_gps_data();  // use gps as active device
  // collect temperature data from thermometer
  therm.listen();
  read_thermometer_data(); // now use therm
  // LCD becomes the active device here
  LCD.listen();
  LCD.print("Data gathered...");
  ...
}

In this example, we assume that read_gps_data() uses the gps object and read_thermometer_data() uses the therm object. Any time you call the listen() method, it becomes the “active” object, and the previously active object is deactivated and its RX buffer discarded. An important point here is that object.available() always returns 0 unless object is already active. This means that you can’t write code like this:

void loop()
{
  device1.listen();
  if (device1.available() > 0)
  {
    int c = device1.read();
    ...
  }
  device2.listen();
  if (device2.available() > 0)
  {
    int c = device2.read();
    ...
  }
}

This code will never do anything but activate one device after the other.

Signal Inversion

“Normal” TTL serial signaling defines a start bit as a transition from “high” to “low” logic.  Logical 1 is “high”, 0 is “low”.  But some serial devices turn this logic upside down, using what we call “inverted signaling”.  As of version 10, NewSoftSerial supports these devices natively with a third parameter in the constructor.

NewSoftSerial myInvertedConn(7, 5, true); // this device uses inverted signaling
NewSoftSerial myGPS(3, 2); // this one doesn't

Library Version

You can retrieve the version of the NewSoftSerial library by calling the static member library_version().

int ver = NewSoftSerial::library_version();

Resource Consumption

Linking the NewSoftSerial library to your application adds approximately 2000 bytes to its size.

Download

The latest version of NewSoftSerial is available here: NewSoftSerial12.zip.  Note: don’t download this if you have Arduino 1.0 or later.  As of 1.0, NewSoftSerial is included in the Arduino core (named SoftwareSerial).

Change Log

  1. initial version
  2. ported to Arduino 0013, included example sketch in package
  3. several important improvements: (a) support for 300, 1200, 14400, and 28800 baud (see caveats), (b) added bool overflow() method to test whether an RX buffer overflow has occurred, and (c) tuned RX and TX for greater accuracy at high baud rates 38.4K, 57.6K, and 115.2K.
  4. minor bug fixes — add .o file and objdump.txt to zip file for diagnostics.
  5. etracer’s inline assembler fix to OSX avr-gcc 4.3.0 interrupt handler bug added.
  6. ladyada’s new example sketch, fix to interrupt name, support for 328p.
  7. etracer’s workaround is now conditionally compiled only when avr-gcc’s version is less than 4.3.2.
  8. 8 MHz support and flush() and enable_timer0()  methods added
  9. digitalread/write scrapped in favor of direct port I/O.  Revised routines now get perfect RX up to 57.6K on 16MHz processors and 31.25K on 8MHz processors.
  10. inverted TTL signalling supported.  20MHz processors supported.  Teensy and Teensy++ supported.  New end() method and destructor added to clean up.
  11. added listen() method to explicitly activate ports.
  12. warn users about 1.0 conflict

Acknowledgements

Many thanks to David Mellis, who wrote the original SoftwareSerial, and to the multi-talented ladyada, whose work with AFSoftSerial is seminal.  Ladyada also provided the “Goodnight, moon” example sketch, fixed a problem with the interrupt naming (see v6) and tested NSS with the 328p.

Thanks also to rogermm and several other forum users who have tested NewSoftSerial and given useful feedback.

The diligent analysis of forum user etracer yielded the root cause of a tricky problem with NSS on OSX.  A bug in avr-gcc 4.3.0 causes the compiler to fail to generate the proper entry and exit sequences for certain interrupt handlers.  etracer identified the problem and provided an inline workaround.  etracer’s fix is in NSS 5.

User jin contributed a large body of work based on NSS and identified a potential problem that could result in data loss (fixed in NSS 5).  jin also made a variant of NSS that supports 4-pin serial, with the additional pins providing a very nice RTS/CTS flow control.  We may see this in NSS in the near future.

Thanks to Garret Mace, who contributed the delay tables for 20MHz processors and claims that he can send and receive at 115K baud.  Cool!

Thanks to Paul Stoffregen, both for his fine work with Teensy and Teensy++, and for contributing some useful suggestions that help NewSoftSerial run on them without modification.

I appreciate any and all input.

Mikal Hart

Page last updated on July 3, 2013 at 7:37 pm
647 Responses → “NewSoftSerial”

  1. Mikal

    15 years ago

    Coofer,

    I think in your case I would modify NewSoftSerial::recv() to call an external function in your main code body every time a character was received. Something like this:

    if ((_receive_buffer_tail + 1) % _SS_MAX_RX_BUFF != _receive_buffer_head) 
    {
      // save new data in buffer: tail points to where byte goes
      _receive_buffer[_receive_buffer_tail] = d; // save new byte
      _receive_buffer_tail = (_receive_buffer_tail + 1) % _SS_MAX_RX_BUFF;
      extern void myfunc(); // This is something defined in your code
      myfunc(); // where you would retrieve the new character
    } 
    

    Remember that myfunc() will be called in interrupt context, so make sure whatever happens there is quick!

    Mikal


  2. Mo

    15 years ago

    Hey,

    Thanks a lot for this library; I was starting to lose hope of being able to read my RFID reader with arduino! However, I am still having some problems…

    The RFID reader runs at 57600 baud rate, and my only issue with using the UART is the reader uses inverted logic, and there were some bytes that are missed. I am not sure why it does that… perhaps because of all the processing I have to do to invert it again; would that cause it to lose bytes? In any case, when I use the NSS, it reads all 38 bytes… nearly fine. It isn’t perfectly accurate. I get an extra “1” every now and then. So for a 4-byte number that I am expecting to be 993101, the first byte is supposed to be a 0, but it is instead sometimes 128, which makes the whole number become negative. I’m not sure if that’s the only issue; I haven’t dissected the results too fully yet.

    There’s another inaccuracy that is more persistent… When expecting a 42, I instead get 170, which is simply an extra 1.
    42=0010 1010, 170=1010 1010.

    Do you have any suggestions for tweaking the library a little bit to get it more accurate?

    I’m using arduino-0022 software, NSS 10 library(the one posted here at the time of writing this) on an arduino Uno (16MHz)

    Thanks,
    Mo


  3. Mikal

    15 years ago

    Mo,

    Timing is a dicey thing and can actually vary from board to board, especially at high speeds. 57600 is certainly a tricky one. The best I can recommend is that you play with the timing table for 16MHz.

      { 57600,    10,        37,        37,       33,    }, 

    Try changing the first 37 to, say, 36.

    If you are missing bytes (and you can prove this by checking overflow()), then you probably are doing too much processing in the background.

    Mikal


  4. SysRun

    15 years ago

    Hi,

    it is possible to catch and generate UART-Break-Conditions? (http://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter#Break_condition)

    There are some Systems (like my Heating-System) which marks a end of a data-telegram with this Breaks.

    Regards,
    Fred


  5. Mikal

    15 years ago

    Sorry SysRun, NewSoftSerial is not configured to detect Breaks, and doesn’t have any mechanism for reporting such events back to the caller program.

    Mikal


  6. Mark

    15 years ago

    Mikal,
    You are the man. I am brand new to Arduino but I had your NewSoftSerial and TinyGPS (with Sparkfun breakout for Venus634LPx) up and running in no time. Excellent!


  7. tom

    15 years ago

    hi, thanks for NSS…
    i need some help. i have seeeduino (atmega168 @ 16Mhz) soft Arduino 0022 NSS 10c version. with NSS RX is all ok but with TX is somthing wrong…
    simple test:
    ////////////////////////////////
    #include

    NewSoftSerial mySerial(3, 4);

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

    void loop()
    {
    mySerial.print(‘a’);
    delay(1000);
    }
    ////////////////////////////////

    and from debuging terminal i got ONLY FIRST char ok. terminal show bits (01100001 11000010 11000010 11000010……) after reset board the same (01100001 11000010 11000010 11000010……). if i change char ‘a’ to ‘z’ i got (01111010 11110100 11110100……). all bits are shifted by one bit. can someone help me? thanks


  8. Chris

    15 years ago

    @Mikal,

    I am working on the same issure with getting the touchshield slide to transmit to the the Arduino Mega on pins 2,3 which are interupts 4,5 on the mega and not the 0,1 of the 328.

    Can you send me a copy also.

    Thanks,
    Chris

    @dullard,

    I sent a beta copy of the new version to your email. Try it out!

    Mikal


  9. Rainer

    15 years ago

    Hej Mikal,

    this library looks like a very nice piece of software! Do you think it’s possible to use it for very low bitrates (50 baud or less) as well? And how would I calculate the timing values (DELAY_TABLE table[]) then?

    I’d like to use it for data transmission from a high altitude amateur balloon down to earth and that requires such a slow bitrate.

    Thanks in advance and regards, Rainer


  10. Mikal

    15 years ago

    @Rainer–

    I think you could get NewSoftSerial to work at 50 baud by simply adding a new row to table. To calculate the values, just multiply the values for 300 baud by 6. (This is not an exact way to do it but for these large values the error should be negligible.)

    One thing to note though, is that at such speeds the millis() timer won’t work properly because you’re turning off interrupts for such long durations.

    Mikal


  11. pedro

    15 years ago

    Hello there! how i can use this library to comunicate with my Bluetooth Bee conected to shield and to arduino? i need to configure it, so i need a code that send what i send to arduino to xbee shield and what the bluetooth answer send me back, sorry for my english!

    i got this:

    Xbee Shield
    http://www.seeedstudio.com/depot/xbee%C3%82%C2%AE-shield-v11-by-seeedstudio-p-419.html

    Bluetooth Bee
    http://www.seeedstudio.com/depot/bluetooth-bee-p-598.html

    Arduino Uno
    http://arduino.cc/en/Main/ArduinoBoardUno

    Thanks a lot for the library!


  12. rin

    15 years ago

    Hi,

    I have fiddled with the delay constants and found that, in my particular environment (Duemilanove, 16MHz, IDE 0022), they need be corrected as follows to work.

    { 14400, 76, 160, 160, 157, },
    { 9600, 117, 242, 242, 239, },
    { 4800, 243, 494, 494, 491, },
    { 2400, 494, 996, 996, 993, },
    { 1200, 995, 1998, 1998, 1995, },
    { 300, 4004, 8017, 8017, 8014, },

    For 19200bps and up, they work as is.

    Thanks,
    rin


  13. Mikal

    15 years ago

    That’s most interesting. I rather expect that high baud rates might experience some sensitivity on different crystals, but it’s really surprising that your low baud rates, which are usually quite tolerant, vary. Thanks for the contribution.

    Mikal


  14. rin

    15 years ago

    @Mikal,

    Yes, I expected the contrary but that’s what I saw. The range of tolerance was small even with lower speeds (300 or 1200), such as within 5 or 6 ‘rx intrabits’. Perhaps in lower speeds, the number of multiplication is bigger so the time difference is bigger, whereas in higher speeds smaller multiplication makes more constant time of delay?

    These values are stable over several different Duemilanove clones (different crystals, some even with Ceralock) which I’ve tested, so it’s not the crystal. They are all with FTDI chips.

    Anyway, thanks for this great work.

    rin, Tokyo


  15. Mao

    15 years ago

    Hi,

    Thanks a lot for this great library.
    I try to communicate with a device which only accept:
    8 bits of data
    1 bit of even parity
    2 stop bits
    Is there a way to configure your library to handle this?


  16. Mikal

    15 years ago

    Sorry Mao. I’m afraid there isn’t any support for such configurations.

    Mikal


  17. Ross

    15 years ago

    Hello Mikal,

    A newbie here. You say “It extends support to all Arduino pins 0-19”. I recognise 0-13 on the Duemilanove. Do the A0-A5 pins correspond to the 14-19?

    Thanks for your great library resource.

    Cheers,

    Ross


  18. Mikal

    15 years ago

    Ross, you’re quite right. It’s not very well documented, but each of the “analog” pins can double as a “digital” pin. A0-A5 = 14-19.

    Mikal


  19. Allen

    15 years ago

    @Mikal

    Is there a way I can look at each char coming on interrupt and trigger a function based on that char? It has been a while since I’ve coded in C and I am very rusty on the code for the arduino. I’m actually just looking for the CR on this one as it is a request from another computer for data. Running 2400. Thought about just using the interrupt on 2 but it would drop LOW multiple times during the request and I don’t want to push data out every time that happens.


  20. henieck

    15 years ago

    A tried to use this library to read from mobile phone – It works OK only for short phone serial buffers – but when I try to get longer SMS message form the phone (using AT commands) – I can only read 63 bytes out of 90 in my example. After sending appropriate AT command – the response form the phone should be 90 bytes long – but function “available” shows only 63 bytes – and there is so many bytes waiting in the phone buffer indeed. Looks like the rest of the chain is cut off. I don’t know – if I do something wrong – but there is no problem reading the whole message form the phone when I use typical Serial function in place of NewSoftSerial. Also there is no problem reading when I use Hyperterminal.


  21. Mikal

    15 years ago

    Allen, there is no built-in way to do that, but if you modify the recv() function you could have it call an external function in your sketch like this:

    if ((_receive_buffer_tail + 1) % _NewSS_MAX_RX_BUFF != _receive_buffer_head)
    {
    // save new data in buffer: tail points to where byte goes
    _receive_buffer[_receive_buffer_tail] = d; // save new byte
    _receive_buffer_tail = (_receive_buffer_tail + 1) % _NewSS_MAX_RX_BUFF;
    extern void foo(uint8_t c);
    foo(d);
    }

    Mikal


  22. Mikal

    15 years ago

    @henieck–

    There is a 64-byte buffer in NewSoftSerial. You are using the following strategy, which won’t work:

    1. Send AT command
    2. Wait for available() to show that 90 characters have been received.
    3. Read the characters

    This won’t work because available will never return a value greater than 63. Try this strategy instead:

    1. Send AT command
    2. Keep reading characters as they arrive until you have read the entire message.

    For example, if you expect exactly 90 characters, you might do this:

    char buf[90];
    for (int i=0; i<90; )
    if (nss.available())
    buf[i++] = nss.read();

    Mikal


  23. LU

    15 years ago

    HI,
    does newsoftserial support arduinoBT?


  24. Mikal

    15 years ago

    @LU, I’ve never tried an arduinoBT, but I feel pretty sure that it is similar enough to an ordinary Uno to guess that NewSoftSerial should work fine.

    Mikal


  25. uyeop

    15 years ago

    hi, im a newbie here.. does your library support mega 1280? i wanted to use the software serial on duemilanove but right now i only have mega. So, can i just try the software serial on mega first?


  26. Mikal

    15 years ago

    The very newest NewSoftSerial is in beta (http://arduiniana.org/2011/01/newsoftserial-11-beta/). It has support for the Mega. Read the post about which pins are supported for RX.

    Mikal


  27. RD

    15 years ago

    I have newsoftserial running on a atmega644p. below the macros needed to set the interupt structure to match the pinout listed for the Sanguino.

    Have only tested on a few pins on portC. If any one else has a Sanguino, would you verify. When i get a board setup, i will finish verifying the rest of the pins. This should work on the 1284 as well, since the interupts are the same.

    This is running in Arduino v22.

    #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)

    #define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0))
    #define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 13) ? 0 : 1))
    #define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0))))
    #define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) = 0 && (p) <= 31) ? (&PCICR) : ((uint8_t *)0))
    #define digitalPinToPCICRbit(p) (((p) <= 7) ? 1 : (((p) <= 15) ? 3 : (((p) <= 23) ? 2 : 0)))
    #define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK1) : (((p) <= 15) ? (&PCMSK3) : (((p) <= 23) ? (&PCMSK2) : (((p) <= 31) ? (&PCMSK0) : ((uint8_t *)0)))))
    #define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 15) ? ((p) – 8) : (((p) = 10) && ((p) = 50) && ((p) = 62) && ((p) = 10) && ((p) = 50) && ((p) = 62) && ((p) = 10) && ((p) = 50) && ((p) = 62) && ((p) = 10) && ((p) = 62) && ((p) <= 69)) ? ((p) – 62) : \
    0 ) ) ) ) ) )


  28. RK

    15 years ago

    What I am doing wrong?
    I have this code witch was working on the old library, but with newsoftwaresserial is not working.
    I am trying to communicate with a GPS from Libelium.
    Who can help me and tell me where is my mistake.


    SoftwareSerial SerGPS(9,8);

    //Create a ‘fake’ serial port. Pin 8 is the Rx pin, pin 9 is the Tx pin.
    SerGPS.begin(9600);
    while(byteGPS != 42)
    { // read the GGA sentence
    if (SerGPS.available());
    byteGPS = SerGPS.read();
    inBuffer[i++]== byteGPS;
    }


  29. captnkrunch

    15 years ago

    Yes, newsoftserial disables millis timer significantly at lower baud rates. My experience in processing a continuous data stream at 2400 baud shows that millis reports 44,000 milliseconds per minute.


  30. Mikal

    15 years ago

    @RK–
    Change that to

    while(byteGPS != 42)
    { // read the GGA sentence
      if (SerGPS.available())
      {
        byteGPS = SerGPS.read();
        inBuffer[i++]== byteGPS;
      }
    }

  31. Mikal

    15 years ago

    @Capn,

    Yup, but only at 2400 and lower.

    Mikal


  32. Wagner Sartori Junior

    15 years ago

    Sanguino, atmega644 and atmega644p support available on http://code.google.com/p/sanguino/issues/detail?id=15

    I’ll be glad if you add it to your current code.


  33. tol

    15 years ago

    hello guys!

    can i ask a help from you, i am designing a wireless meter, i am using arduino with gsm module, the problem is the gsm module cannot communicate correctly to the arduino, i cant do program that suitable to the module and arduino and it will works, anyone can help me?


  34. Simon

    15 years ago

    Hi!

    I need to use newsoftserial with a device that requires 7E1.
    Are you going to implement it?

    Simon


  35. Mikal

    15 years ago

    Hi Simon,

    I don’t think it would be too hard, but no, I’m afraid I don’t currently have any plan to implement E71. Anyone like to give it a try? The main difficulty would be making sure that the changes don’t disrupt the bit timings.

    Mikal


  36. Gabriel Leen

    15 years ago

    Hi Mikal,
    Thanks for NewSoftSerial!
    Just a question as I’m getting an unexpected compile error.
    I’ve a Touchshield Slide which connects to a Duemilanove. The native Hardware Serial port on the Duemilanove is used to communicate with the Touchshield Slide. I’ve tried to use NewSoftSerialand I’m just getting compile errors: ‘`digital_pin_to_port_PGM’ and ’port_to_input_PGM’. Can you help ?
    A) the IDE is the Antipasto branch of the Arduino IDE, version: 0018-Antipasto-0043
    B) I put the .h & .ccp in: Antipasto/hardware/arduino/cores/touchscreen/src/components/board, is this the correct directory?

    Here is a link to where I posted the error (in more detail) and have received no reply yet. (http://arduino.cc/forum/index.php/topic,57456.0.html)
    Thanks for your help!!!!
    Gabriel


  37. eazry

    15 years ago

    this my first time use newsoftserial…
    anybody can help me to teach how to install the newsoftserial…???
    thanks a lot…


  38. Joe Foley

    15 years ago

    Hi there. I’ve been enjoying using your NewSoftSerial 10 for a project I’m working on, to get good iRobot Create control out of an UNO on nonUSART pins. Problem is that the receive buffer seems to loose it at 56K after about 5 bytes. I see a buffer of 64, so I would assume that is the limit. Am I missing something?


  39. guillaume

    15 years ago

    Hi,

    I tried using the NewSoftSerial library, but I am unshure about two points:

    is it
    NewSoftSerial mySerial(softRx, softTx); or
    NewSoftSerial mySerial(softTx, softRx); ?

    Also I suppose that it is not necessary to declare the pins softTx and softRx as OUTPUT and INPUT in the setup() function. Am I right? Maybe it is even forbidden?

    Maybe you can add these points to the documentation while I try to succeed with try and error…

    Best regards,
    Guillaume


  40. Mikal

    15 years ago

    @Joe, there are two reasons you might experience data corruption. The first is that you are not retrieving the data fast enough and the buffer is overflowing. The second is that you are using a high baud rate and the timer tunings are not quite working out for your clock. 56K is quite a high rate for Arduino soft serial, so either is conceivable. One way to tell is to check nss.overflow(). If that returns true you know you’re experiencing buffer overflow. Unfortunately, at 56K, it’s also possible that the deserializer simply can’t keep up. Is there any way to slow down the device you are communicating with?


  41. Mikal

    15 years ago

    @guillame–

    The general convention is RX first, then TX, but you are quite right that this could be made more clear in the documentation. Thanks.

    As far as declaring the pins before using the library, my thinking is that any decently-written library should handle all the pinMode settings for you. Once you “give” those pins to the library, you shouldn’t touch them. That is the case here. Although it doesn’t hurt to declare them as INPUT/OUTPUT, in the interest of avoiding confusion I recommend leaving the pinMode definitions out.

    By the way, I enjoy your poetry. It’s good to see that you’re still around! :)


  42. Tim

    15 years ago

    Maybe you should point out this doesnt coexist very well with the Servo library.

8 Trackbacks For This Post
  1. Step-by-Step Guide on using the Bluetooth Bee, Bees Shield & Arduino to communicate via bluetooth | Michael Chuah

    […] up would be to try and use the awesome NewSoftSerial library by Mikal Hart to communicate with the Bluetooth Bee by emulating the UART […]

  2. Tutorial: Arduino and GSM Cellular – Part One « t r o n i x s t u f f

    […] a software perspective we will need the NewSoftSerial Arduino library, so please download and install that before moving […]

  3. Interfacing Arduino to GSM shield | Embedded projects from around the web

    […] goes step by step how to connect Cellular shield to Arduino mega and communicate to it by using newsoftserial Arduino library. Whole process steps are monitored in terminal window, so it is easy to follow […]

  4. Fully functional Arduino GPS logger « Liudr's Blog

    […] NewSoftSerial library […]

  5. LCD117 Controller Library - Jack Kern

    […] also need the NewSoftSerial library installed in your Arduino sketchbook’s library […]

  6. Touch game for the offspring | NinjaTool inc.

    […] GLCD that I bought (without knowing ANYTHING about it beforehand I might add). The code uses the NewSoftSerial library which apparently does wonders, but as of yet has not been validated as the code assumes a 9V […]

  7. Arduino GSM and GPRS shield | Open Electronics

    […] the pin 4 and 5 there aren’t problems to upload the sketch but the maximum baudrate for NewSoftSerial (the serial library) is 57600. We performed a GSM library to controll easly the module. The GSM […]

  8. Moving Forward with Arduino – Chapter 19 – GPS part II « t r o n i x s t u f f

    […] forget the 10k ohm pull-down resistor). You will need to install the SdFAT library, NewSoftSerial library, TinyGPS library and the SdFat library if not already […]

Leave a Reply