I am trying to buid a robot arm, and have trouble with controlling it. I have some code written to make the arm move back and forth, and some code to connect a bluetooth module. The problem is that I have no clue how to continue because I am quite new to coding. Is there anyone who would like to help me out?
I am using:
Arduino Uno
PCA9685 servo driver
HC-05 bluetooth
MG996R servo
initially forget the Bluetooth
run example code provided with the PCA9685 library
once you understand the library get the servo operating the robot arm using commands from the serial monior
once that is working add the Bluetooth control
consider moving to an ESP32 which has built in Bluetooth Classic and BLE
You have to decide what you want to be able to tell your arm to do. Then you need to express each of those actions into a string of characters. That may be as simple as sending an angle to each of the servos. That can be done with a string of numbers, like: 90, 27, 73, 14, 170
You can add markers to indicate which servo each number is for so you don't have to send them all every time: A90, B27, C73, F14, G170
With that, you would read characters until you find a marker and then call .parseInt() to read the number.
Bluetooth works just like Serial so, for now, I would use Serial and your PC to send commands. Later you can switch to Bluetooth and send the commands wirelessly.