Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2023:vstoica:andradacojocaru [2023/05/28 23:08]
andrada.cojocaru [Software Design]
pm:prj2023:vstoica:andradacojocaru [2023/05/30 08:22] (current)
andrada.cojocaru [Software Design]
Line 104: Line 104:
 Declararea variabilelor globale pentru miscarea servo-motoarelor - de aici pornesc Declararea variabilelor globale pentru miscarea servo-motoarelor - de aici pornesc
 <code c> <code c>
-int servoRightLeftPos = 45+int servoRightLeftPos = 35
-int servoUpDownPos = 90;+int servoUpDownPos = 76;
 </​code>​ </​code>​
  
Line 146: Line 146:
  
   // set where the servo start   // set where the servo start
-  servoRightLeftPos = 45+  servoRightLeftPos = 35
-  servoUpDownPos = 90;+  servoUpDownPos = 76;
   setServoAngle(SERVO_RIGHT_LEFT_PIN,​ servoRightLeftPos);​   setServoAngle(SERVO_RIGHT_LEFT_PIN,​ servoRightLeftPos);​
   setServoAngle(SERVO_UP_DOWN_PIN,​ servoUpDownPos);​   setServoAngle(SERVO_UP_DOWN_PIN,​ servoUpDownPos);​
Line 157: Line 157:
 **Loop** - citim ldr-urile si in functie de valorile obtinute calculam media celor de sus, de jos, dreapta, stanga si apoi diferenta dreapta-stanga,​ sus-jos si observam daca valoarea e mai mare decat toleranta, caz in care trebuie sa mutam pozitia ansamblului.\\ **Loop** - citim ldr-urile si in functie de valorile obtinute calculam media celor de sus, de jos, dreapta, stanga si apoi diferenta dreapta-stanga,​ sus-jos si observam daca valoarea e mai mare decat toleranta, caz in care trebuie sa mutam pozitia ansamblului.\\
 Am determinat experimental valorile intre care trebuie servo-motoarele mutate: Am determinat experimental valorile intre care trebuie servo-motoarele mutate:
-  *  pt cel dreapta-stanga ​90 +  *  pt cel dreapta-stanga -10 - 60 
-   ​* ​  pt cel sus-jos ​60 110+   ​* ​  pt cel sus-jos ​76 96
 In functie de pozitia soarelui sau absenta lui am afisat mesaje relevante pe lcd: In functie de pozitia soarelui sau absenta lui am afisat mesaje relevante pe lcd:
   * Est jos -> dimineata   * Est jos -> dimineata
Line 186: Line 186:
   if (abs(diffrightleft) >= TOLERANCE) {   if (abs(diffrightleft) >= TOLERANCE) {
     if (diffrightleft < 0) {     if (diffrightleft < 0) {
-      if (servoRightLeftPos < 90) {+      if (servoRightLeftPos <= 60) {
         servoRightLeftPos++;​         servoRightLeftPos++;​
         setServoAngle(SERVO_RIGHT_LEFT_PIN,​ servoRightLeftPos);​         setServoAngle(SERVO_RIGHT_LEFT_PIN,​ servoRightLeftPos);​
       }       }
     } else if (diffrightleft > 0) {     } else if (diffrightleft > 0) {
-      if (servoRightLeftPos > 0) {+      if (servoRightLeftPos >= -10) {
         servoRightLeftPos--;​         servoRightLeftPos--;​
         setServoAngle(SERVO_RIGHT_LEFT_PIN,​ servoRightLeftPos);​         setServoAngle(SERVO_RIGHT_LEFT_PIN,​ servoRightLeftPos);​
Line 201: Line 201:
   if (abs(difftopbottom) >= TOLERANCE) {   if (abs(difftopbottom) >= TOLERANCE) {
     if (difftopbottom < 0) {     if (difftopbottom < 0) {
-      if (servoUpDownPos < 110) {+      if (servoUpDownPos <= 96) {
         servoUpDownPos+=5;​         servoUpDownPos+=5;​
         setServoAngle(SERVO_UP_DOWN_PIN,​ servoUpDownPos);​         setServoAngle(SERVO_UP_DOWN_PIN,​ servoUpDownPos);​
       }       }
     } else if (difftopbottom > 0) {     } else if (difftopbottom > 0) {
-      if (servoUpDownPos > 60) {+      if (servoUpDownPos >= 76) {
         servoUpDownPos-=5;​         servoUpDownPos-=5;​
         setServoAngle(SERVO_UP_DOWN_PIN,​ servoUpDownPos);​         setServoAngle(SERVO_UP_DOWN_PIN,​ servoUpDownPos);​
pm/prj2023/vstoica/andradacojocaru.1685304531.txt.gz · Last modified: 2023/05/28 23:08 by andrada.cojocaru
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0