v1

Dependencies:   PinDetect TextLCD mbed

Fork of SunflowerMach1 by Milan Draganic

Files at this revision

API Documentation at this revision

Comitter:
mdraganic
Date:
Mon Nov 11 19:01:15 2013 +0000
Parent:
9:764eb7341754
Child:
11:f243d8ed556d
Commit message:
done and over :)

Changed in this revision

MotorDrivers/Motor.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MotorDrivers/Motor.cpp	Mon Nov 11 14:04:12 2013 +0000
+++ b/MotorDrivers/Motor.cpp	Mon Nov 11 19:01:15 2013 +0000
@@ -7,7 +7,9 @@
     pwmOut = motorPwmInitDutyCycle;
     
     positiveOut = 0;
-    negativeOut = 0;   
+    negativeOut = 0;  
+    direction = 0; 
+    pwmOut = 1;
 }
 
 void Motor::start() {
--- a/main.cpp	Mon Nov 11 14:04:12 2013 +0000
+++ b/main.cpp	Mon Nov 11 19:01:15 2013 +0000
@@ -2,8 +2,8 @@
 #include "Motor.h"
 #include "TextLCD.h"
 
-#define sensorStartTreshold     0.05
-#define sensorStopTreshold      0.01
+#define sensorStartTreshold     0.08
+#define sensorStopTreshold      0.02
 
 #define calibrateFactorSenzA    1
 #define calibrateFactorSenzB    0.97
@@ -18,13 +18,13 @@
 TextLCD lcd(p13, p14, p5, p6, p7, p8); // rs, e, d4-d7
 
 DigitalOut ledBoot(LED1);
-DigitalOut ledAz(LED3);
+DigitalOut ledAz(LED3); 
 DigitalOut ledEl(LED4);
 
-AnalogIn ainSensA(p17);
-AnalogIn ainSensB(p18);
-AnalogIn ainSensC(p19);
-AnalogIn ainSensD(p20);
+AnalogIn ainSensA(p16);
+AnalogIn ainSensB(p17);
+AnalogIn ainSensC(p18);
+AnalogIn ainSensD(p19);
 
 float valAzimut = 0;
 float valElevacija = 0;
@@ -72,12 +72,12 @@
     
 }
 
-int main() {
+int main() {   
 
     ledBoot = 1;
     pc.baud(serialOutputBaudrate);
-    Motor *motorAz = new Motor(p25, p26, p24);
-    Motor *motorEl = new Motor(p22, p21, p23);
+    Motor *motorAz = new Motor(p28, p27, p26); // relej, relej, pwm
+    Motor *motorEl = new Motor(p24, p23, p25);
     if(lcdOutputEnable) {
         lcd.cls();
         lcd.printf("Suncokre\n");    
@@ -87,7 +87,9 @@
     ledBoot = 0;
 
     while(1) {
-        
+
+// ---- citanje senzora ------------    
+    
         readValuesForAveraging();
         
 // ----- azimut -----
@@ -122,7 +124,7 @@
         
 // ----- pauza ------
 
-        wait_ms(200);        
+        wait_ms(100);        
     }
 }