Hi guys ive run into a problem with the serial.print and serial.println functions.
im trying to write an information message to show the user to to operate a robotic claw via serial. and the message comes out garbled, the first few letters of the first line and then the other half of the message. and then it repeats itself. the the arduino cant process it all in one loop
i looked through the arduino website and it didnt mention how to overcome this problem. and a c++ tutorial page recommended me to use cout<< but that didnt work.
this is the message im trying to show the user
b = bend / t = twist
df = default position
grip = grip object / release = release it
type numbers 1-180 to position the servos
example: 90t will twist the claw 90degrees
im using this code:
void setup() {
Serial.begin(9600);
//myservoa.writeMicroseconds(1500); //set initial servo position if desired
myservoa.write(98);
myservoa.attach(6); //the pin for the servoa control
myservob.write(0);
myservob.attach(7); //the pin for the servob control
myservoc.write(30);
myservoc.attach(8); //the pin for the servoc control
Serial.println("b, = bend / t, = twist");
Serial.println("df, = default position");
Serial.println("grip, = grab object / release = release it");
Serial.println("type numbers 1-180 to postion the servos");
Serial.println("example: 90t, will twist the claw 90degrees");
}
and it shows this message in the serial monitor
b,0t, will twist the claw 90degrees
= grab object / release = release it
type numbers 1-180 to postion the servos
example: 90t, will twist the claw 90degrees
b, = bend / t, = twist
df, = default position
grip, = grab object / release = release it
type numbers 1-180 to postion the servos
example: 90t, will twist the claw 90degrees
does anybody know a way to get the arduino to print out the full message, once?
the program works fine, so i didnt think anybody would be interested in reading the whole thing seeing as its the serial monitor part im having trouble with. in the full program though the servos are attached to different starting positions
im just trying to put the finishing touches to it and i thought user instructions would be a nice addition.
ive only even seen 9600 before, im pretty new to the whole arduino/programming scene, not sure what you mean by f macro either.
but ill look into it first chance i get. thanks for the heads up guys
ive only even seen 9600 before, im pretty new to the whole arduino/programming scene
Then you should definitely looking at the reference page for every function you are using. Look at what 9600 means, and what options there are, for Serial.begin().
not sure what you mean by f macro either.
I don't believe anyone mentioned an f macro. There is an F macro.
Serial.print("I'm going to be moved to SRAM";
Serial.print(F("But I am not"));