Can't execute function in C based on keyboard input?
2coolcode
Posts: 5
I am trying to blink a led on the board which works fine, but I am trying to pass how long I want the pause to be in between each blink based on a keyboard input
I want the pause() function to execute based on what is entered in the keyboard, so for example if I enter "35" , i want the function to be passed as pause(35);
this doesn't work , instead if times out as if there's a non-numeric trailing character in the value or as if it's reading something else
been a long time since I dove back into C , can someone see what's going wrong here?
#include "simpletools.h" // Include simpletools
int main() // main function
{
while(1)
{
print("\n enter blink interval:");
scanf("%c", vpause);
print("\n you entered, %c\n");
high(0);
pause(vpause);
low(0);
pause(vpause);
}
}
I want the pause() function to execute based on what is entered in the keyboard, so for example if I enter "35" , i want the function to be passed as pause(35);
this doesn't work , instead if times out as if there's a non-numeric trailing character in the value or as if it's reading something else
been a long time since I dove back into C , can someone see what's going wrong here?
#include "simpletools.h" // Include simpletools
int main() // main function
{
while(1)
{
print("\n enter blink interval:");
scanf("%c", vpause);
print("\n you entered, %c\n");
high(0);
pause(vpause);
low(0);
pause(vpause);
}
}
Comments
Working examples can be found in the simpletext test program - also in the SimpleIDE package. https://code.google.com/p/propsideworkspace/source/browse/Learn/Simple Libraries/Text Devices/libsimpletext/libsimpletext.c
Can simpletools be bundled with the other libraries already available in the plain GCC release?
If that's what Parallax wants. I'll ping Jeff about it.