Tobis Programm forked to not destroy your golden files
Fork of Robocode by
Diff: source/Robot.cpp
- Revision:
- 73:f7657ddb7827
- Parent:
- 72:4e8a151d804e
- Child:
- 75:dba260cb5ae4
--- a/source/Robot.cpp Fri Apr 21 12:12:57 2017 +0000 +++ b/source/Robot.cpp Fri Apr 21 12:37:07 2017 +0000 @@ -22,6 +22,9 @@ #define RESTART 0x80 #define SLEEP 0x10 +#define servo0center 300 +#define servo2center 300 + const float PERIOD = 0.001f; // period of control task, given in [s] const float COUNTS_PER_TURN = 1200.0f; // resolution of encoder counter @@ -289,9 +292,17 @@ // Servo 4 = Arm_1 // Servo 6 = Arm_2 // Servo 8 = Grabber + if (servo == 0) { + deg = servo0center + 3*deg; + } + if (servo == 2) { + deg = servo2center + 3*deg; + } + + //only for tests with putty if (deg < 0 || deg > 4095) { deg = 300; - } + char data[2]; int16_t wert1 = (deg>>8); int16_t wert2 = (deg & 0xFF);