Hello Arduino Forum!
Wondering if anyone can point me in the right direction as I have no idea where to start. Basically I want to do 3 things:
- read the values from 3 potentiometers
- ask the user to title the data
3.write the data to a file on an sd card with the file name being what the user submitted.
I have the code to read and hold values for the pots. How can I have an lcd blink the cursor and scroll through the alphabet so the user can name the file?
Thanks for any help!
It’s not clear what your are stuck with? If it’s the cycling through characters, the below code cycles through the characters 0…9, A…Z and a…z on a keypress.
returns next character when a button is pressed, else null character
supports 0..9. A..Z and a..z
// variable to hold character
static char character = '0';
// if button pressed
if (digitalRead(yourbutton) == LOW)
// next character
// if 0..9, A..Z, a..z
if ((character >= '0' && character <= '9') ||
(character >= 'A' && character <= 'Z') ||
(character >= 'a' || character <= 'z'))
// after 'Z' comes 'a'
if (character > 'Z')
character = 'a';
// after 'z' comes '0'
if (character > 'z')
character = '0';
// no button pressed
No debouncing implemented; not tested. Note that it returns the NULL character if no key was pressed, else the next character. So you need to remember the previous value; or you can change the code to return the last character (as commented at the end).
Note: button wired between pin and ground.
There is a simple example of user input in Planning and Implementing a Program