Do NOT modify!
Dependencies: mbed Servo ServoArm
Fork of PES_Yanick by
Diff: Sources/main.cpp
- Revision:
- 10:f76476943a6c
- Parent:
- 7:6fed0dcae9c1
- Child:
- 11:292bdbd85a9c
--- a/Sources/main.cpp Tue May 02 08:00:19 2017 +0000 +++ b/Sources/main.cpp Wed May 03 13:54:51 2017 +0000 @@ -26,20 +26,30 @@ PwmOut right(PA_9); DigitalOut powerSignal(PB_2); -DigitalIn errorSignal(PB_14); +DigitalIn errorMotor(PB_14); DigitalIn overtemperatur(PB_15); //Arm: -Servo servoArm(PA_6); +ServoArm servoArm(PA_6); + +//Greifer: +Servo servoGreifer(PC_7); //Farbsensor: AnalogIn FarbVoltage(A0); -Robot sam( &left, &right, &powerSignal, leds, &FarbVoltage, &frontS, &leftS, &rightS, &servoArm); //Implement the Farbsensor into the Robot init function!! +Robot sam( &left, &right, &powerSignal, leds, &FarbVoltage, &frontS, &leftS, &rightS, &servoArm, &servoGreifer ); //Implement the Farbsensor into the Robot init function!! + +void initializeDistanceSensors(){ + for( int ii = 0; ii<9; ++ii) { + sam.sensors[ii].init(&sensorVoltage, &frontS, &leftS, &rightS, &bit0, &bit1, &bit2, ii); + + enable = 1; + } +} - -/* * / +/* */ int main(){ initializeDistanceSensors(); //Initialises IR-Sensors. int counter = 0; //Counts how many times the robot has turned, before driving @@ -48,6 +58,7 @@ int found = 0; //0:= no block available, 1 := a lego is ready to be picked up while( 1 ){ + if ( timer > TIMEOUT ){ NVIC_SystemReset(); //Resets Sam. } @@ -97,7 +108,7 @@ } /* */ -/* */ +/* * / int main(){ sam.stop(); int done = 0; //1:= finished process; 0:= not finished @@ -128,4 +139,6 @@ } wait(0.1); } -} \ No newline at end of file +} + +*/ \ No newline at end of file