From da9860f9a414d8ab403496ac74a51afc5ad3e48b Mon Sep 17 00:00:00 2001 From: sicarius Date: Sun, 18 Feb 2007 17:57:03 +0000 Subject: +++ Additional Codework --- source/Concept/Framework/main.c | 53 ++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 8 deletions(-) (limited to 'source/Concept/Framework/main.c') diff --git a/source/Concept/Framework/main.c b/source/Concept/Framework/main.c index fa6d718..7822933 100755 --- a/source/Concept/Framework/main.c +++ b/source/Concept/Framework/main.c @@ -132,13 +132,54 @@ int main() uint16 value = 0; int8 value2 = 0; Display* ourDisplay = localRobot->GetModule(IO_DISPLAY_MAIN); + Keyboard* ourKeyboard = localRobot->GetModule(IO_KEYBOARD_MAIN); uint32 i = 1; - Ball_Tracker* ourBallTracker = localRobot->GetModule(IO_BALL_TRACKER_MAIN); + Navigator* ourNavigator = localRobot->GetModule(IO_NAVIGATOR_MAIN); + float rotation = 0; + + ourDisplay->Print("Starting...", 1, 1); //Run while(true) { - msleep(500); + uint8 someInput = ourKeyboard->GetInput(); + switch(someInput) + { + case 1: + ourNavigator->Drive(225.0f * PI / 180.0f, rotation, 200, rotation); + break; + case 2: + ourNavigator->Drive(180.0f * PI / 180.0f, rotation, 200, rotation); + break; + case 3: + ourNavigator->Drive(135.0f * PI / 180.0f, rotation, 200, rotation); + break; + case 4: + ourNavigator->Drive(270.0f * PI / 180.0f, rotation, 200, rotation); + break; + case 5: + ourNavigator->Stop(); + break; + case 6: + ourNavigator->Drive(90.0f * PI / 180.0f, rotation, 200, rotation); + break; + case 7: + ourNavigator->Drive(315.0f * PI / 180.0f, rotation, 200, rotation); + break; + case 8: + ourNavigator->Drive(0.0f * PI / 180.0f, rotation, 200, rotation); + break; + case 9: + ourNavigator->Drive(45.0f * PI / 180.0f, rotation, 200, rotation); + break; + case 10: + rotation -= 10; + break; + case 12: + rotation += 10; + break; + } + msleep(50);/* ourDisplay->Clear(); ourDisplay->Print(i++); ourSensor = localRobot->GetModule(IO_SENSOR_IR_0_DEG); @@ -172,15 +213,11 @@ int main() ourSensor = localRobot->GetModule(IO_SENSOR_IR_330_DEG); value = ourSensor->GetIRIntensity(); ourDisplay->Print(value); - ourDisplay->Print(";"); - value2 = (localRobot->GetModule(IO_SENSOR_MOUSE_LEFT))->GetXMovement(); - ourDisplay->Print(value2, 10, 4); - value2 = (localRobot->GetModule(IO_SENSOR_MOUSE_LEFT))->GetYMovement(); - ourDisplay->Print(value2, 15, 4); + ourDisplay->Print(";");*/ localRobot->Update(); - ourDisplay->PrintFloat(ourBallTracker->GetBallDirection(), 1, 4); + //ourDisplay->PrintFloat(ourBallTracker->GetBallDirection(), 1, 4); } //Cleanup -- cgit v1.2.3