different data varibles through bluetooth communication

I want to send joystick data and switch status through Bluetooth and retrieve two data variables at receive side & to separately read two data variables.
joystick data to be send to DAC output & switch data to digital pin out.

earlier also I posted this for help.

Now I am able to transfer both the data variables through Bluetooth Master and able to see the receiving of two data variables on Serial Monitor of receiver side(Slave).

But unable process / retrieve two data variables separately on slave board(Due board)

Pl.help me

}[code] 
   // Master side Code
  
  void loop() {
     pot_brakeState[0]=analogRead(A0);
     pot_brakeState[1]=digitalRead(brake);
    
     BTSerial.print(pot_brakeState[0]);
     BTSerial.println(pot_brakeState[1]);  
}

 //Slave side (please help me on slave code)

void loop() {
  
    int pot_brakeState[2] = {BTSerial.parseInt()};
    analogWrite(DAC0,pot_brakeState[0]);
    digitalWrite(led,pot_brakeState[1]);
   
}



 /*int feedbackPos=analogRead(A0);
  int setPoint = BTSerial.parseInt();
  if(setPoint<200||>500)
  int output=(setPoint-feedbackPos);
  Serial.print(setPoint);
  Serial.println(feedbackPos);
  if(output=516)
  analogWrite(DAC0,0);
  else if(output<=515)
  analogWrite(DAC0, output);
 
  delay(10);*/

[/code]

The first thing to do is to only read the serial input when data is available
Secondly, parseInt() does what it says, ie ie gets 1 int from serial, not an array.

Take a look at Serial input basics - updated for ideas about how to pass and parse data via a serial link

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.