The libraries are probably fighting over the same resources. Can you give some more details? How are things wired up? I presume by the title you suspect an interrupt issue, what interrupts are being used?
Jeremy
--
You received this message because you are subscribed to the Google Groups "Reading Hackspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reading-hacksp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I haven't used the software serial library for a while, but it is a serious resource hog. I think it waits for a pin interrupt on the serial rx pin, then disables interrupts, and decodes the whole character with interrupts disabled. So running your ss at 9600 will give (10 * 100us) 1ms of zz time for each character. The characters may be contiguous, and I guess there are about 50 in any GPS string. I guess your GPS is sending messages once per second, and we don't need to send any data to the GPS. With some GPS you can change the interval between messages, and reduce the number of message types sent.
As Andrew suggests, using hardware serial is better, but many arduino only have one serial port. I try to use Leonardo rather than uno, so as to have two serial ports, one hardware and one USB.
I note you are using the ping_timer() function, which should be better than the base ping() in newping. It depends on which arduino you use, but this uses timer 2 on most ATMega Arduino. I don't think Timer 2 is used by anything else in your code. I would have thought, that the software serial should not spoil the distance readings.
You should probably play around with the overall timing on a more simple sketch. Your code and the newping library use other timer functions, which will be distorted by the software serial. Scheduling the pings seems a bit of a faf on timing , maybe just do the pings one after each other.
Stiil, looks like you are making good progress,
Cheers,
Richard
--