Shop OBEX P1 Docs P2 Docs Learn Events
getchar(); ? — Parallax Forums

getchar(); ?

johnprokojohnproko Posts: 121
edited 2015-02-13 18:41 in Learn with BlocklyProp
#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!

Comments

Sign In or Register to comment.