Is this correct now?
I can't use the blue it because it only uses number not a string, it wont let me attach.
This is just an example of what you need to do with this red block to get 3 inputs. I never wrote that you should use a blue block....
My bad. However, unfortunately the code didn't work but gave me this instead.
This is correct, these extra numbers in front are caused by this code:
Serial.print(servo5Pos);
Instead, use this:
Serial.println(servo5Pos);
Omg, didn't realized thanks.
Still, the servo doesn't rotate. What could be wrong?
The application correctly sends the code to Arduino, the numbers are correctly converted to the integrer. Something isn't working somewhere in this code:
if (servo5PPos > servo5Pos){
for (int pos = servo5PPos; pos >= servo5Pos; pos--) {
HCPCA9685.Servo(5, pos);
delay(20);
}
}
if (servo5PPos < servo5Pos){
for (int pos = servo5PPos; pos <= servo5Pos; pos++) {
HCPCA9685.Servo(5, pos);
delay(20);
}
}
servo5PPos = servo5Pos;
}
}
Debug it by sending various messages to the serial monitor.
This article warns about how to get required current to the servo:
Feel like this has something to do with the library I used <HCPCA9685.h>. Instead of the new one <Adafruit_PWMServoDriver.h>.
Will look into this.
Here's another link to study:
One of us will probably have to figure out what I2C is all about.
I'm recharging my battery for the servo driver as of the moment. Will see if it does make a difference.
Update.
It works now, it turns out there was not enough power for PCA9685. Now, I'm adding more servo and see how it will turn out. I'll be back when I get another problem. Thank you, guys!
So, here's the thing the code works but I've notice there were too much data when sliding the slider which makes it go unstable, perhaps because of the bluetooth too much data going in.
I found this from you @ABG. Is this right thing to do? is this for MIT or Arduino?
This is for the AI2 blocks, because that's where the slider is.
This code slightly limits data sending. Only integer values will be sent, and only if their value actually changes.
The best solution is to use slider tools or something similar extension and send the data on touch up.
What's the Clock approach do and what's the difference between @Patryk_F approach?
Also, I somehow manage to alleviate the problem. I just set the delay() much lower. I looked up and it said it is better for accuracy and responsiveness, though it also said I might break the servo.