1 (edited by vagyver 2020-04-16 14:29:22)

Topic: Servos' PWM get crazy

Hello!

I have connected 6 servos at the 6 hardware capable pins of Arduino Uno (these are 3,5,6,9,10,11).

When i am connected to RemoteXY app (in my android) servos get crazy (but i can still move them thought the RemoteXY).
What servos do is to start crazily moving without having told them to do so, randomly.  But close to their current position.


So, i want to ask if RemotXY app uses any interrupt or any time sensitive registers that destroys PWM' use.
Can i disable something?
Is it a known problem?

Because i can't find any other reason.

I'm using bluetooth HC05 module for communication.


I'm looking for your answer.
Thank you in advance!

Vangelis

2 (edited by vagyver 2020-04-16 15:17:43)

Re: Servos' PWM get crazy

I made a good search here in forum and i found an answer from administrator saying that u can't use soft_serial and PWM at the same time.

Well, i did tried that and worked. Servos behave ok now.


But this is not a nice solution because i want to use hardserial to send serial data too.

So, is there any other solution, not occupying hard serial?
Is it a matter a time critical interrupts?



And my very last question:
What is the maximum delay() value allowed, so that i don't do any problem to the RemoteXY_Handler ();

Thank you for your time!

3

Re: Servos' PWM get crazy

I think delays just make the interface less responsive.  Its like reducing the polling interval when sampling switch positions in hardware.
I use a library called Metro, which creates non blocking timers.

you create a timer Metro myTimer = Metro(1000); for a one second timer

then in your loop,  if(myTimer.check()) do something.

you can have many timers for different tasks like update the RemoteXY display every 500ms and check status of something every 3 minutes etc.

metro library can be found here https://github.com/thomasfredericks/Met … ino-Wiring

4

Re: Servos' PWM get crazy

If you want to use Servo.h library, you have to use hardware serial for RemoteXY.
If you want to use hardware serial for other task, you have to use the board which have several hardware serial port, Arduino Mega for example. Or Arduino Leonardo which have separate USB (serial) and Serial1 (pins 0,1).
There may be a library for servo that does not conflict with the software serial.