Epileptische Linie Cop. Sophie GmbH
Dependencies: mbed
Fork of Schwarze_Linie1Vorbuebung by
Revision 1:a5392efd321c, committed 2016-06-15
- Comitter:
- SophieRechar
- Date:
- Wed Jun 15 07:16:59 2016 +0000
- Parent:
- 0:b4f9731c4fad
- Commit message:
- Epileptische Linie Cop. Sophie GMbH
Changed in this revision
Uebung1.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b4f9731c4fad -r a5392efd321c Uebung1.cpp --- a/Uebung1.cpp Wed Jun 08 11:31:26 2016 +0000 +++ b/Uebung1.cpp Wed Jun 15 07:16:59 2016 +0000 @@ -6,7 +6,7 @@ DigitalIn ISO2 (P0_16); DigitalIn ISO3 (P0_23); DigitalIn ISO4 (P0_15); -DigitalIn ISO5 (P1_3); // OSI5 +DigitalIn ISO5 (P1_3); DigitalOut LedD1 (P1_10); DigitalOut LedD2 (P1_11); @@ -21,33 +21,47 @@ DigitalOut LedD12 (P1_20); DigitalOut LedD13 (P1_21); -DigitalOut MotorL_EN(P1_19); // Enable -DigitalOut MotorL_FORWARD(P2_14); // Forwärts -DigitalOut MotorL_REVERSE(P2_15); // Rückwärts +PwmOut MotorL_EN(P1_19); +DigitalOut MotorL_FORWARD(P2_15); +DigitalOut MotorL_REVERSE(P2_14); -DigitalOut MotorR_EN(P2_19); //Die Leitung führt zum Pin PO_21 am Prozessor -DigitalOut MotorR_FORWARD(P2_21); //Die Leitung führt zum Pin P1_3 am Prozessor -DigitalOut MotorR_REVERSE(P2_20); - +PwmOut MotorR_EN(P2_19); +DigitalOut MotorR_FORWARD(P2_20); +DigitalOut MotorR_REVERSE(P2_21); int main() { - + MotorL_EN.period_ms(10.0f); + MotorR_EN.period_ms(10.0f); + do { - LineON=1; - Von=1; - MotorR_EN=MotorL_EN=1; + MotorR_EN = MotorL_EN = 0.3; + LineON = 1; + Von = 1; - if(ISO1==0) - { - LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=0; - MotorR_FORWARD=MotorL_FORWARD=1; - } -else -{ - LedD1=LedD2=LedD4=LedD5=LedD6=LedD7=LedD8=LedD9=LedD10=LedD11=LedD12=LedD13=1; - MotorR_FORWARD=MotorL_FORWARD=0; + MotorR_FORWARD = MotorL_FORWARD = 1; + + if(ISO1 == 0) + { + MotorR_FORWARD = MotorL_FORWARD = 0; + MotorL_EN = 0.7; + MotorL_FORWARD = 1; + MotorR_FORWARD = 0; + } + + else if(ISO4 == 0) + { + MotorR_FORWARD = MotorL_FORWARD = 0; + MotorL_EN = 0.7; + MotorL_FORWARD = 0; + MotorR_FORWARD = 1; + } + + else if(ISO5 == 0) + { + MotorR_FORWARD = MotorL_FORWARD = 0; + MotorR_FORWARD = MotorL_FORWARD = 0.3; + } + }while(1); } - }while(1==1); -}