Controlling of several servos with different angles - via Bluetooth

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

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

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);
}

			}
		}
		for (int pos = 90; pos >= 0; pos--) {
			mainmovementServo.write(pos);
			delay(30);
			while (pos = 0) {
				for (int pos2 = 0; pos2 <= 30; pos2++) {
					movementviasides1.write(pos2);
					delay(30);
				}

			}

		}
	}


}

}**
```

Please don't blame me for the long variable names!
Hope you can help me!

Is this a quiz game where we try to guess what the problem is?

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

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.

So it is a quiz and now we are getting clues.

but when I try the servos, it goes haywire,

haywire - Not very scientific term.

What exactly are they doing?
How have you got the servos powered?
Is it on a different supply?
Do you have supply decoupling on the servo motors?

Grumpy_Mike:
haywire - Not very scientific term.

What exactly are they doing?
How have you got the servos powered?
Is it on a different supply?
Do you have supply decoupling on the servo motors?

Basically, the 1 servo has to move 90 degrees and the 2nd one has to move the arm downwards by 30 degrees, to pick up the stuff.

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!

Advik

You already have a thread for this, where people are trying to help you:
http://forum.arduino.cc/index.php?topic=578731

pert:
You already have a thread for this, where people are trying to help you:
Controlling of several servos with different angles - via Bluetooth - Project Guidance - Arduino Forum

Well, that's different, that's the Bluetooth thing.

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.

Threads merged.

Four questions, one answer.
Do better.

Do a lot better.

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,

How do you expect us to be able to help you when you have not posted the code you tried or a schematic showing how everything is connected.

How are you powering your servos? If you are drawing power for the servos from the Arduino 5v pin then that is probably the cause of the problem.

...R

external 9v battery. code is posted at the top of the thread. im working on the schematics.

What exactly are they doing? Tick answered

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.

Steve

Close this thread. I have resolved my issue.

What sort of a person are you?
If you have solved your problem then please say what it was. It might help others.