I am trying to make a control board for a rgbw light that is controlled with my phone over bluetooth. My problem now it that if I move the slider to fast I get garbage data on the output (I included a picture of good and garbage data). My thought was to have it send a bulk data set of the position of all 4 sliders at a scheduled interval to keep it from going to fast. I have looked online but I can't find a way to do it that I understand.
How I have it setup now is I have a touch listener setup on a Slider so every time the slider is moved it grabs the position and sends it.
If you could point me in the right direction to what is should be looking for that would be greatly appreciated.
How I have it setup now is I have a touch listener setup on a Slider so every time the slider is moved it grabs the position and sends it.
Code:
SliderR.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
GetR(); //method to get position of R
RValue1.setText(Short.toString(Rpos));
return false;
}
});
Code:
private void GetR(){
Rpos = (short) SliderR.getProgress();
if (btSocket!=null)
{
try
{
btSocket.getOutputStream().write("R".getBytes());
btSocket.getOutputStream().write(Rpos);
}
catch (IOException e)
{
msg( "Error");
}
}
}