getchar(); ?
johnproko
Posts: 121
#include "stdio.h"
#include "simpletools.h"
#include "servo.h"
char ch;
int x;
int main()
{
x = 0;
print("initial\n");
servo_angle(16, 0);
pause(5000);
while(1)
{
ch = getchar();
pause (1000);
if (ch = "a");
{
x = x + 1;
print("x= %d\n", x);
servo_angle(16, x);
pause(100);
}
}
}
hello everyone, i want to control my robotic arm using my keyboard. after some search i came up with the getchar() function.
if not any alternative?
i would like to know how can i clear the screen. clsrc() doesnt work...
thank you!
#include "simpletools.h"
#include "servo.h"
char ch;
int x;
int main()
{
x = 0;
print("initial\n");
servo_angle(16, 0);
pause(5000);
while(1)
{
ch = getchar();
pause (1000);
if (ch = "a");
{
x = x + 1;
print("x= %d\n", x);
servo_angle(16, x);
pause(100);
}
}
}
hello everyone, i want to control my robotic arm using my keyboard. after some search i came up with the getchar() function.
if not any alternative?
i would like to know how can i clear the screen. clsrc() doesnt work...
thank you!
Comments
Would cursor control characters used with print() from the simpletools library work for you to clear the screen? Take a look at the Did You Know section about 2/3 of the way down on this page:
http://learn.parallax.com/activitybot/test-whiskers