Hello, I am a beginner, facing problems with a project I have. Please see the code and see what's wrong.
The project is a robotic arm with the use of a custom-made Bluetooth app, and a TC-05 module. ```
**#include <SoftwareSerial.h> //Tx and Rx library for Bluetooth module #include <Servo.h>
Servo mainmovementServo;
Servo movementviasides1;
Servo movementviasides2;
Servo movementpicking;
int bluetoothTx = 10; //location of Tx
int bluetoothRx = 11; //location of Rx
void setup()
{
mainmovementServo.attach(13); // PORT 13
movementviasides1.attach(12); // PORT 12
movementviasides2.attach(8); // PORT 8
movementpicking.attach(7); // PORT 7
//this is a weirdly far distance, this is gonna be very very very unorganised...
//SERIAL MONITOR BEGINS
Serial.begin(9600);
bluetooth.begin(9600); // test for device and surroundings!
}
void loop()
{
if (bluetooth.available() > 0) //test if signal is made
{
int numberreceived = bluetooth.read(); //stores the number in a variable
Serial.println(numberreceived); // prints the number received
if (numberreceived = 1)
{
for (int pos = 0; pos <= 90; pos++) {
mainmovementServo.write(pos);
delay(30);
while (pos = 90) {
for (int pos2 = 30; pos2 >= 0; pos2--) {
movementviasides1.write(pos2);
delay(30);
}
Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.
Robin2:
Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.
...R
Robin2:
Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.
...R
I still didn't get anything. I am pretty sure that the Bluetooth part works, but when I try the servos, it goes haywire, the mainmovement one gets jammed and I don't know, if you had any code to help, it would be helpful. Thank you.
Advik007:
I still didn't get anything. I am pretty sure that the Bluetooth part works, but when I try the servos, it goes haywire, the mainmovement one gets jammed and I don't know, if you had any code to help, it would be helpful. Thank you.
Hello, I am a very basic beginner. I have learnt to get a servo to sweep by 180 degrees, but unfortunately I want to see if I can move two servos with different angles ( probably 90° and 30°). I do not have any idea where to begin, and all those tutorials show the servos moving simultaneously (by decreasing delay) with the same angle (180° or something).
Could anyone please help me by teaching me what the code would be when trying to do such a project? Help would be really appreciated!
It would be different if you had kept that topic specifically about Bluetooth, but it's not. It's about Bluetooth and "moving with different angles" and this one is about "moving with different angles" so it's still cross posting.
How have you got the servos powered? Cross Not answered
Is it on a different supply? Cross Not answered although you might think so by saying external 9v battery. But this is useless. What sort of 9V battery. Small smoke alarm batteries are useless.
Do you have supply decoupling on the servo motors? Cross Not answered
SERIOUSLY if you want help you have to be a lot better that you are showing yourself to be at the moment.
If "external 9V battery" is an answer to "How are you powering your servos?" then that's definitely a problem. Get a proper battery like 4 x AAs instead.