I Hope somebody of you can help me with my problem:
Basically i try to manage that the Arduino is waiting for an ACK Message at the Serial Port before i send further Instructions to the Slave.
I'm using an Arduino Mega2560 as a Master of an EPOS2 50/5 by Maxonmotor. The communication goes over the Serial1 Channel.
I have tryed to declare the Waiting for the Acknowledge as a Function of the Datatype Boolean who turns false at receiving the Ack... But the Compiler is Reporting following Failure:
"function definition does not declare parameters"
And when i declare a boolean Variable as Argument of the Function its reporting:
"WaitforAck was not declared in this scope".
All function declarations need parentheses around the argument list, EVEN IF THE LIST IS EMPTY (like it is for loop()).
return=true;
return is a keyword. You can NOT use it as a variable name. Variables must be typed.
if (RXmot1 == ack)
{
return false;
Serial.println("Received ACK");
}
It's pointless to put anything after the return statement. The return statement terminates the function. Obviously, nothing after that will be executed.
Thanks a lot! I will try it as soon i have access to my Board !
while (WaitforAck())
{
}
This means that the Program is entering the While loop and waits there until the WaitforAck turns false...
So how di i ensure that the boolean expression WaitforAck is true at the beginning because the While Loop is checking the expression before execution. In a bad case there is no execution...