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?
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
*/
char keypress()
{
// variable to hold character
static char character = '0';
// if button pressed
if (digitalRead(yourbutton) == LOW)
{
// next character
character++;
// if 0..9, A..Z, a..z
if ((character >= '0' && character <= '9') ||
(character >= 'A' && character <= 'Z') ||
(character >= 'a' || character <= 'z'))
{
return character;
}
// after 'Z' comes 'a'
if (character > 'Z')
{
character = 'a';
return character;
}
// after 'z' comes '0'
if (character > 'z')
{
character = '0';
return character;
}
}
else
{
// no button pressed
return '\0';
// OR
//return character;
}
}
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).