I am currently using a slider in a project. I watched several videos and combined many different techniques to display the value of the slider on the screen just below the slider. I then tried to transmit the value over Bluetooth to an Arduino Pro Mini.
Bluetooth transmission and reception seem to work very well. The issue is when I place my finger on the slider and remove my finger from the slider. Almost as I have button debounce.
I have created code in MIT App Inventor to address 1 digit, 2 digit, and 3 digit numbers. But when the Arduino receives the values, I sometimes lose one or more digits. I can see this on the Arduino IDE Serial monitor using Serial.print() commands. So the performance is a bit "flaky".
The baud rate is 9600 on both the serial monitor and the Bluetooth connection. Maybe I need to increase the baud rate of the HC-06 Bluetooth module that I am using??? I do execute the Serial.print() commands to the Arduino serial monitor only AFTER I receive a stream of data, so i am not really sure whether or not the serial monitor is creating a disruption.
Can you give more information on your code? An .aia for example and a .ino file, or some important parts of the code. My hunch is that the slider events fire much too fast. It is possible to do something about that, but it depends on what you want to do with the values.
I was trying to transmit 2 different slider values over Bluetooth to an Arduino Pro Mini (3.3V). As the data was transmitting in real-time, it was getting corrupted. There seemed to be issues with my finger being on the sliders and how I pressed and released the slider.
So I tried using a timer to better regulate the slider function. This improved the received data slightly, but still not reliable enough.
Finally, I created a SET button. I move the sliders where I want them to be, and then I press set. Now I have a VERY reliable way to control exactly what I am trying to send from the smartphone over Bluetooth (HC-06) to the Arduino Pro Mini (3.3V).
Hi Neal,
So, my hunch was right. The slider event just happens too fast.
If the solution with the set button is ok for you, then fine.
Otherwise you could indeed use a timer, that should fire slower than your baud rate. Maybe half a second or so. And you could have tricks like waiting for the slider to settle at some position.
Anyway, you can save some energy for your phone by not catching the slider event.