sasasa

Dependencies:   HMC6352 PID eeprom mbed

Fork of ver1_2_2_1 by ryo seki

Revision:
1:89408fff7cc9
Parent:
0:74bf4953c0d1
Child:
2:09fabba6c00d
--- a/main.h	Sat Mar 09 10:11:06 2013 +0000
+++ b/main.h	Sun Mar 10 07:31:31 2013 +0000
@@ -10,23 +10,26 @@
 #define ON      1
 #define OFF     0
 
-#define MOT1    1
-#define MOT2    1
-#define MOT3    1
-#define MOT4    1
+#define MOT1    1.0
+#define MOT2    1.0
+#define MOT3    1.0
+#define MOT4    1.0
 
-#define OUT_LIMIT 30.0
+#define OUT_LIMIT   30.0
+#define MAX_POW     100
+#define MIN_POW     -100
 
 DigitalOut led1(LED1); 
 DigitalOut led2(LED2);
 DigitalOut led3(LED3);
+DigitalOut led4(LED4);
 HMC6352 compass(p9, p10);
 Serial driver(p28, p27); // tx, rx 
 Serial pc(USBTX, USBRX); // tx, rx 
 DigitalIn StartButton(p21);
 DigitalIn CalibEnterButton(p22);
 DigitalIn CalibExitButton(p23);
-PID pid(0.42, 1.0, 0.013, RATE);      //30.0 0.35 1.0 0.012
+PID pid(0.59, 1.0, 0.015, RATE);      //30.0 0.35 1.0 0.012 30.0 0.42 1.0 0.013 
 Ticker pidUpdata;
 Ticker IR;
 Ticker ultrasonic;
@@ -36,7 +39,7 @@
 
 
 int speed[MOT_NUM] = {0};
-
+ 
 static float lastData = 0.0;
 static float inputPID = 180.0;
 static float standard;
@@ -48,7 +51,7 @@
 extern int Distance;
 extern int IR_found;
 extern double ball_sankaku[16][2];
-extern uint16_t ultrasonicVal[3];
+extern double ultrasonicVal[3];
 
 extern void Ultrasonic(void);
 extern void IR_Position(void);