Go Down

Topic: Servo motor not working as per code (Read 1 time) previous topic - next topic

Jovinufaber

So, obvious question...does it correctly play 1.wav which it should do before moving the servos?

Why not add a few Serial.prints so you can see what exactly is in the variable voice and so what bits of the code it really gets into?

Steve


It does correctly play 1.wav file. But doesn't do anything with the servo. Other else-if statements work  without a flaw too and there is no problem.

Jovinufaber

#16
Sep 15, 2018, 11:10 am Last Edit: Sep 15, 2018, 11:22 am by Jovinufaber
Update: The servo works normally when the "speech.play("1.wav")" is removed. It seems both don't work together.

slipstick

It looks like both TMRpcm.h and Servo.h use timer 1. Maybe using ServoTimer2.h instead would help but you'll have to change the servo writes to microSecond format not angle e.g. write(544 or 2400) not write(0 or 180).

Or if you're not using a UNO you may be able to change the timer that TMRpcm uses.

Steve

Go Up