jung6717 / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Servo library incompatible with NewSoftSerial #177

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
From Mikal Hart: "I can officially confirm that NewSoftSerial (and really any 
software serial library) is 
incompatible with the new Servo library that ships with Arduino 0017.  The 
problem is that the new 
Servo library, which is really quite cool, depends on reliable interrupts, 
where software serial 
solutions require interrupts to be disabled -- at least for short periods of 
time.  I discovered this 
issue when I was trying to upgrade my Reverse Geocache box to 0017, and the 
only workaround I 
could come up with was to downgrade the Servo library back to 0016."

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1262033431

This could be a problem because I'd like to switch over to NewSoftSerial in 
future Arduino versions.

Original issue reported on code.google.com by dmel...@gmail.com on 9 Jan 2010 at 10:52

GoogleCodeExporter commented 8 years ago
Hi,

This issue needs to be very clearly documented, since the new Servo library is 
also
incompatible with using delayMicroseconds - a nasty surprise that took quite a 
few
hours for me to figure out.  Upgrading to Arduino 0017 totally broke my 
software.

Access to the hardware PWM output is a must for these cases.  I'd rather have 
both
libraries separately, since checking the pin number at runtime would require 
both
libraries to be included in the code, bloating it unnecessarily.

As a workaround I now copied the Servo library from 0013 to a new name within my
project.  Overall I'd like to see more emphasis in the documentation on what 
library
features are dependent on interrupts being enabled, and what is the effect of 
using
for example delayMicroseconds on them.

Original comment by sampo.ni...@gmail.com on 18 Jan 2010 at 5:13

GoogleCodeExporter commented 8 years ago
The Issue with delayMicroseconds was fixed in 0018.

Prior to 0018, delayMicroseconds would disable interrupts for the duration of 
the 
delay which made it incompatable with any code that relied on interrupts to be 
serviced promptly.

In 0018, delayMicroseconds no longer disables interrupts.

For those that don’t want to upgrade from 0017 to 0018 and want to use the 
new servo 
library, a compatible version of delayMicroseconds can be cut and pasted from 
0018 
or copied from this thread:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1257266907/3#3

Original comment by memargolis@gmail.com on 6 Feb 2010 at 3:32

GoogleCodeExporter commented 8 years ago
I also confirm that NewSoftSerial conflicts with Servo library. I have just 
tested it in a helicopter project...

Original comment by kostale...@gmail.com on 30 Jul 2010 at 3:35