I'm building an inverted pendulum. I have two rotary encoders and a 12V DC motor.

Right now when I try to run the DC motor and change one of the rotary encoders, the rotary encoder will not print to the serial monitor. However, when I unplug the DC motor, the rotary encoder works fine, so I think the communication isn't fast enough here or there's something I'm doing wrong (and this is just for one rotary encoder!).

Room for improvement:

  1. Upgrade from an Elegoo Uno board to an actual Arduino Uno board (perhaps something even better).

  2. Change the serial baud rate from 9400 b/s.

  3. Instead of using digitalRead, analogWrite, etc., write code that is more efficient.

Here is a gist of my testing code right now for reference. My question is, how can I get the most out of the Arduino communication? How can I make it be as fast as possible without (or minimal) errors?

  • Why do you think, this is due the communication being not fast enough? The code works correctly, if you unplug the motor. Maybe your power supply is not strong enough – chrisl Aug 20 '19 at 8:40
  • Post your schematic as well, perhaps there is a small design error in it. – CrossRoads Aug 20 '19 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.