Go Down

Topic: Servos and software serial (Read 399 times) previous topic - next topic

Bob_McNair

Hi All, I wonder if anyone can help.
Ive googled a lot and not really found anything helpful.
Im working on a project where I need to use HC12 radio modules to control Servos.
Thje problem is that software serial libraries and Servo libraries appear to clash as many threads I have found on Google confirm.
I have a servo library (Servo2) which is supposed to cure this, it doesent.
Ive tried NeoSWSerial as well as SoftwareSerial neither work together.
Depending where in the main loop the code is, either Servo will work or SW serial but never both.
Does anyone have a solution to this as wireless is the only option and this needs SW Serial to talk to the HC12.

Thanks in advance

Bob

Bob_McNair

Hi All,
Problem solved.
Ive ditched using the now old hat Uno.
Im using a Mega for development and will use a Leonardo in my project, which has a second hardware serial port.
So no need for the crappy Software serial.
I will make sure anymore Duinos I buy use the newer 32U4 chip with a spare serial port for radio devices!!!
Better buy a few in for my development work.

Cheers
Bob

cod65

#2
Apr 10, 2018, 09:15 am Last Edit: Apr 10, 2018, 09:19 am by cod65
hmm ,
maybe this is why my life with Arduinos and controlling servos over serial  has been so horrible!?

I've been trying to use an Uno i had around  mostly, wondering if the usb serial was a bottleneck ?
I'm fairly noob I don't fully understand but ....Uno only has 1 serial port, correct? and that is thru usb? Whereas a Leonardo has an additional hardware serial port ? is this more apropos for realtime control of servos from a PC?


slipstick

Servos don't use Serial. It's just that the Servo library and SoftwareSerial use the same timer. For most people using ServoTimer2 library solves that. No idea why it didn't for the OP.

If you need several different serial connections then something other that the UNO/Nano (ATmega328P boards) may be better but controlling servos doesn't have a lot to do with it.

Steve

cod65

ah ok. i think i should probably start my own thread with my code.

Go Up