Hey Guys,
Ik leg de laatste hand aan me camera slider nl. de contolle wil ik volledig bleutooth doen.
Na enig onderzoek naar de beste app kom ik op RoboRino of Arduino Total Contol van bijde de betaalde versie.
Ik heb codes die op bv ralais werken of bv 6 ledlampjes (bestuurd via de gratis versie van beide apps)
Ik heb ook codes die goed werken met de joytick AXY assen analog pin A0, A1, A2. - dus niet bleutooth
Ik zag ook dat het mogelijk blijft om gebruik te maken van libraries. - met bleutooth
Toch heb ik het gevoel dat het hele steur om moet (qua code) in tegenstelling tot de analoge besturing.
Ik probeer bv 2 code's te combineren, maar tot nu toe zonder succes.
Dit is het stukje code waar het fout gaat
// Function to read available data from serial input buffer
//
void readData()
{
while ( Serial.available() ) // Read while there are available characters
{
delay(3);
char c = Serial.read();
myString += c; // build the command string
}
Serial.print(myString); // Output the full command string - for debugging
}
//-------------------------------------------------------------------------------------------
//
// Function to check the input data string for validity and extract the command character
//
void checkData()
{
// Is the input data string 4 characters long, starting with sub-string "com" ?
if ((myString.length() == 4) && (myString.startsWith("com") ))
{
validCommand = true;
command = myString[3]; // Get the command character
Serial.print(" command is ");
Serial.println(command);
}
else // input data string must contain at least 1 character, or we get stuck in a loop
if ( myString.length() > 0)
{
validCommand = false;
Serial.println(" command string is invalid");
}
myString = ""; // Clear the input data string for next time
}
//-------------------------------------------------------------------------------------------
//
// Function to process command character and change stepper motor behaviour
//
void processCommand()
{
justRun = false;
stepper1.enableOutputs(); // enable the motor coils
switch (command)
{
case '0':// ... bla bla bla
de comands zitten onder de knoppen van mijn telefoon, de comands komen keurig in de serial aan, arduino leest het ook want hij zegt direct, :" command string is invalid" ...
Alles geporbeerd , hoofdletter gevoeligheid, spatie met/zonder aanhalingstekens... letterlype heb je niet in de hand zag ik.
iemand een idee? er zijn zelfs na veel speurwerk niet veel hapklare skatches te vinden