PaulS:
It should be controlled by bluetooth (at the end) and also follow a defined route.
Manual control (via bluetooth) and autonomous action (following a defined route) are mutually exclusive modes.
Wow, really? After loosing the bluetooth connection it runs home.
if(bolNeedTm == true)Look like a real programmer, and lose the == true bit...
That's true.
iCurTicks1 = iCurTicks1 + 1;You know, you aren't programming the Arduino using a language called C=C+1. Embrace the ++ operator, like a real programmer.
Oh, thanks for that hint. I thought it's C#, but C# = C# + 1 doesn't work...
int fctGetReqTicks(unsigned int iMotorNr)
{
float flReqTicks = flMaxAcc / 100 * iSpdDiff;
unsigned int iReqTicks = int(flReqTicks);
return iReqTicks;
}
The function says that it returns an int, yet the return statement returns an unsigned int formed from an int. Consistency is a good (even necessary) thing. *Yes, you're (oh pardon, you are) right, unsigned is better, I don't like negative stuff.*int fctGetSpeedAngle(unsigned int intSpeed)
{
int res = map(intSpeed, 0, 100, 0, 180);
return res;
}This is a pretty inefficient way to multiply by 1.8. The flopping between signed and unsigned values is not a good idea. *This is true again, I really should not copy published code from this forum and use it. I see I am a bad boy :blush:*//RunMotors();
Is your delete key broken? You KNOW that you shouldn't be executing ANY of the commented out code in an interrupt handler. Resist the temptation to uncomment statements by using the delete key. *Oh, I don't have such a key.. you mean the Del key maybe? This political correctness is hard to handle.*if (Serial.available())
{
//verschnaufpause
delay(10);
int i = 0;
while(i<5){
sData[i] = Serial.read();If there is at least one byte to read, read all 5 of them. I'm sure you can see that this is plain wrong. *Yeah I learnd this from the americans! You know, bigger is better! Why drive a Prius if you can drive a fat, inefficient V8 big block?*Serial.flush();
Why? 99.99999% of the time, this statement is added by totally clueless idiots. That isn't you, is it? *Hmmm...good question. Well then the clueless idiots should not post such things...beginners like me believe what Pros tell'em*iRes = atoi(sData);
Wrong! The atoi() function expects a NULL terminated array of chars. You're array is NOT NULL terminated. *This may be, works anyway perfect.*