From 51699171c289c5ff553ed0c9c75c5a108e164fff Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Tue, 6 Oct 2015 14:41:38 -0400 Subject: uploaded code --- src/opcontrol.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 src/opcontrol.c (limited to 'src/opcontrol.c') diff --git a/src/opcontrol.c b/src/opcontrol.c new file mode 100644 index 0000000..b2896a2 --- /dev/null +++ b/src/opcontrol.c @@ -0,0 +1,72 @@ +#include "main.h" + +#define NEAR_THRESH 0.05f + +enum MOTOR { + UNUSED = 0, + ROTATER, + DRIVEL, + DRIVER, + LIFT1, + LIFT2, + INTAKE, + UNUSED7, + UNUSED8, + UNUSED9, + UNUSED10 +}; + +static unsigned char idx=0; +static float intakeRotation=0; + +int nearDegree(float target){ + if(intakeRotationtarget+NEAR_THRESH)return -1; + else return 0; +} + +void operatorControlLCD(void *param){ + static int imeValue=0; + static float nearTarget=0; + while(1){ + imeGet(idx,&imeValue); + intakeRotation=imeValue/1037.0f; + lcdPrint(uart1,1,"%u %d",imeCount,nearDegree(nearTarget)); + lcdPrint(uart1,2,"%u %d",idx,imeValue); + if(joystickGetDigital(1,7,JOY_LEFT)){ + if(idx)idx--; + }else if(joystickGetDigital(1,7,JOY_RIGHT)){ + if(idx