Alexander Welz
/
bertl16_cross_Welz
Bertl16-cross
main.cpp@0:41f8d348b90d, 2016-06-16 (annotated)
- Committer:
- WelzAlex
- Date:
- Thu Jun 16 16:43:31 2016 +0000
- Revision:
- 0:41f8d348b90d
forward-->back-->turn right-->forward-->back-->turn left-->back-->forward-->turn right-->back-->forward-->turn left (loop)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WelzAlex | 0:41f8d348b90d | 1 | //while(1){ VOR (weiss)_ZURUECK(rot)_RECHTS(blinker) } |
WelzAlex | 0:41f8d348b90d | 2 | |
WelzAlex | 0:41f8d348b90d | 3 | #include "mbed.h" |
WelzAlex | 0:41f8d348b90d | 4 | |
WelzAlex | 0:41f8d348b90d | 5 | |
WelzAlex | 0:41f8d348b90d | 6 | DigitalOut Von(P2_13); // 12V on |
WelzAlex | 0:41f8d348b90d | 7 | // Definition der 12 LED's |
WelzAlex | 0:41f8d348b90d | 8 | DigitalOut WSLI(P1_10); //wsS links D1 |
WelzAlex | 0:41f8d348b90d | 9 | DigitalOut WSRE(P1_12); //wsS rechts D4 |
WelzAlex | 0:41f8d348b90d | 10 | DigitalOut GELIVO (P1_11); //ge links vorn D2 |
WelzAlex | 0:41f8d348b90d | 11 | DigitalOut GEREVO (P1_13); //ge rechts vorn D5 |
WelzAlex | 0:41f8d348b90d | 12 | DigitalOut GELIHI(P1_14); //ge links hinten D6 |
WelzAlex | 0:41f8d348b90d | 13 | DigitalOut RTLIHI(P1_15); // rt links hinbten D7 |
WelzAlex | 0:41f8d348b90d | 14 | DigitalOut GEREHI(P1_16); //ge rechts hinten D8 |
WelzAlex | 0:41f8d348b90d | 15 | DigitalOut RTREHI(P1_17); //rt rechts hinten D9 |
WelzAlex | 0:41f8d348b90d | 16 | |
WelzAlex | 0:41f8d348b90d | 17 | DigitalOut ledD10 (P1_18); |
WelzAlex | 0:41f8d348b90d | 18 | DigitalOut ledD11 (P2_16); |
WelzAlex | 0:41f8d348b90d | 19 | DigitalOut ledD12 (P1_20); |
WelzAlex | 0:41f8d348b90d | 20 | DigitalOut ledD13 (P1_21); |
WelzAlex | 0:41f8d348b90d | 21 | |
WelzAlex | 0:41f8d348b90d | 22 | // LDR |
WelzAlex | 0:41f8d348b90d | 23 | AnalogIn LDR(P0_14); |
WelzAlex | 0:41f8d348b90d | 24 | // RGB LED |
WelzAlex | 0:41f8d348b90d | 25 | DigitalOut RGB(P1_22); |
WelzAlex | 0:41f8d348b90d | 26 | // Motor Steuerung Schaltung Pg 2 |
WelzAlex | 0:41f8d348b90d | 27 | DigitalOut MG1_EN(P2_16);// NUR DIGITAL ohne PWM ! ! ! |
WelzAlex | 0:41f8d348b90d | 28 | DigitalOut MG1_F(P2_15); |
WelzAlex | 0:41f8d348b90d | 29 | DigitalOut MG1_R(P2_14); |
WelzAlex | 0:41f8d348b90d | 30 | DigitalOut MG2_EN(P2_19); |
WelzAlex | 0:41f8d348b90d | 31 | DigitalOut MG2_F(P2_20); |
WelzAlex | 0:41f8d348b90d | 32 | DigitalOut MG2_R(P2_21); |
WelzAlex | 0:41f8d348b90d | 33 | //ULTRASCHALL ABSTANDSMESSER |
WelzAlex | 0:41f8d348b90d | 34 | DigitalOut TRIG(P2_22); |
WelzAlex | 0:41f8d348b90d | 35 | DigitalIn ECHO(P2_23); |
WelzAlex | 0:41f8d348b90d | 36 | // Definition der Taster **************** Schaltplan Pg5 |
WelzAlex | 0:41f8d348b90d | 37 | DigitalIn TA1(P1_23); //TA1 |
WelzAlex | 0:41f8d348b90d | 38 | DigitalIn TA2(P1_24); // |
WelzAlex | 0:41f8d348b90d | 39 | DigitalIn TA3(P1_25); // |
WelzAlex | 0:41f8d348b90d | 40 | DigitalIn TA4(P1_26); // |
WelzAlex | 0:41f8d348b90d | 41 | DigitalIn TA5(P1_27); // |
WelzAlex | 0:41f8d348b90d | 42 | DigitalIn TA6(P1_28); // |
WelzAlex | 0:41f8d348b90d | 43 | DigitalIn TA7(P1_30); // |
WelzAlex | 0:41f8d348b90d | 44 | DigitalIn TA8(P1_31); // |
WelzAlex | 0:41f8d348b90d | 45 | // INCREMENTGEBER *********************** Schaltplan Pg 6 |
WelzAlex | 0:41f8d348b90d | 46 | DigitalOut EN_INCR (P2_2); //Incrementgeber Enable |
WelzAlex | 0:41f8d348b90d | 47 | DigitalIn INCR_L1 (P2_6); |
WelzAlex | 0:41f8d348b90d | 48 | DigitalIn INCR_L2 (P2_7); |
WelzAlex | 0:41f8d348b90d | 49 | DigitalIn INCR_R1 (P2_8); |
WelzAlex | 0:41f8d348b90d | 50 | DigitalIn INCR_R2 (P2_9); |
WelzAlex | 0:41f8d348b90d | 51 | // LINE SENSOR *************************** Schaltplan Pg 7 |
WelzAlex | 0:41f8d348b90d | 52 | DigitalOut EN_Line (P2_5); //Enable LINE Sensor |
WelzAlex | 0:41f8d348b90d | 53 | DigitalIn ISO1 (P1_9); // Statt ANALOG hier DIGITAL |
WelzAlex | 0:41f8d348b90d | 54 | DigitalIn ISO2 (P0_23); // nur für einfachen TEST! |
WelzAlex | 0:41f8d348b90d | 55 | DigitalIn ISO3 (P0_16); |
WelzAlex | 0:41f8d348b90d | 56 | DigitalIn ISO4 (P0_15); |
WelzAlex | 0:41f8d348b90d | 57 | DigitalIn ISO5 (P1_3); |
WelzAlex | 0:41f8d348b90d | 58 | // Blue LED ****************************** Schaltplan Pg 8 |
WelzAlex | 0:41f8d348b90d | 59 | DigitalOut LedBl (P1_5); |
WelzAlex | 0:41f8d348b90d | 60 | |
WelzAlex | 0:41f8d348b90d | 61 | |
WelzAlex | 0:41f8d348b90d | 62 | |
WelzAlex | 0:41f8d348b90d | 63 | |
WelzAlex | 0:41f8d348b90d | 64 | int main() |
WelzAlex | 0:41f8d348b90d | 65 | { |
WelzAlex | 0:41f8d348b90d | 66 | |
WelzAlex | 0:41f8d348b90d | 67 | |
WelzAlex | 0:41f8d348b90d | 68 | //ALLE LEDS aus |
WelzAlex | 0:41f8d348b90d | 69 | GELIHI=1; //Gelb links hinten |
WelzAlex | 0:41f8d348b90d | 70 | GEREHI=1;//gelb rehts hinten |
WelzAlex | 0:41f8d348b90d | 71 | RTREHI=1;//Rot rechts hinten |
WelzAlex | 0:41f8d348b90d | 72 | RTLIHI=1; //rot links hinten |
WelzAlex | 0:41f8d348b90d | 73 | GELIVO=1;//gelb links vorne |
WelzAlex | 0:41f8d348b90d | 74 | GEREVO=1;//gelb rechts hinten |
WelzAlex | 0:41f8d348b90d | 75 | WSLI=1;//weiss links vorne |
WelzAlex | 0:41f8d348b90d | 76 | WSRE=1;//weiss rechts vorne |
WelzAlex | 0:41f8d348b90d | 77 | ledD10=1; |
WelzAlex | 0:41f8d348b90d | 78 | ledD11=1; |
WelzAlex | 0:41f8d348b90d | 79 | ledD13=1; |
WelzAlex | 0:41f8d348b90d | 80 | ledD12=1; |
WelzAlex | 0:41f8d348b90d | 81 | |
WelzAlex | 0:41f8d348b90d | 82 | Von =1; |
WelzAlex | 0:41f8d348b90d | 83 | MG1_EN=MG2_EN=1; |
WelzAlex | 0:41f8d348b90d | 84 | |
WelzAlex | 0:41f8d348b90d | 85 | |
WelzAlex | 0:41f8d348b90d | 86 | |
WelzAlex | 0:41f8d348b90d | 87 | |
WelzAlex | 0:41f8d348b90d | 88 | |
WelzAlex | 0:41f8d348b90d | 89 | while(1)//Hauptschleife |
WelzAlex | 0:41f8d348b90d | 90 | { |
WelzAlex | 0:41f8d348b90d | 91 | |
WelzAlex | 0:41f8d348b90d | 92 | int c=0; |
WelzAlex | 0:41f8d348b90d | 93 | int d=0; |
WelzAlex | 0:41f8d348b90d | 94 | int e=0; |
WelzAlex | 0:41f8d348b90d | 95 | int f=0; |
WelzAlex | 0:41f8d348b90d | 96 | |
WelzAlex | 0:41f8d348b90d | 97 | //1 Schleife (vor-zurück-90°rechts) |
WelzAlex | 0:41f8d348b90d | 98 | while(c<1) |
WelzAlex | 0:41f8d348b90d | 99 | { |
WelzAlex | 0:41f8d348b90d | 100 | |
WelzAlex | 0:41f8d348b90d | 101 | |
WelzAlex | 0:41f8d348b90d | 102 | |
WelzAlex | 0:41f8d348b90d | 103 | int i = 0; |
WelzAlex | 0:41f8d348b90d | 104 | int a = 0; |
WelzAlex | 0:41f8d348b90d | 105 | int b = 0; |
WelzAlex | 0:41f8d348b90d | 106 | |
WelzAlex | 0:41f8d348b90d | 107 | MG1_F=MG2_F=1; |
WelzAlex | 0:41f8d348b90d | 108 | |
WelzAlex | 0:41f8d348b90d | 109 | //LED links nach rechts |
WelzAlex | 0:41f8d348b90d | 110 | while(i<1) |
WelzAlex | 0:41f8d348b90d | 111 | { |
WelzAlex | 0:41f8d348b90d | 112 | |
WelzAlex | 0:41f8d348b90d | 113 | WSLI=0; |
WelzAlex | 0:41f8d348b90d | 114 | WSRE=0; |
WelzAlex | 0:41f8d348b90d | 115 | ledD10=0; |
WelzAlex | 0:41f8d348b90d | 116 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 117 | ledD10=1; |
WelzAlex | 0:41f8d348b90d | 118 | |
WelzAlex | 0:41f8d348b90d | 119 | |
WelzAlex | 0:41f8d348b90d | 120 | |
WelzAlex | 0:41f8d348b90d | 121 | ledD11=0; |
WelzAlex | 0:41f8d348b90d | 122 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 123 | ledD11=1; |
WelzAlex | 0:41f8d348b90d | 124 | |
WelzAlex | 0:41f8d348b90d | 125 | |
WelzAlex | 0:41f8d348b90d | 126 | |
WelzAlex | 0:41f8d348b90d | 127 | |
WelzAlex | 0:41f8d348b90d | 128 | ledD13=0; |
WelzAlex | 0:41f8d348b90d | 129 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 130 | ledD13=1; |
WelzAlex | 0:41f8d348b90d | 131 | |
WelzAlex | 0:41f8d348b90d | 132 | |
WelzAlex | 0:41f8d348b90d | 133 | |
WelzAlex | 0:41f8d348b90d | 134 | ledD12=0; |
WelzAlex | 0:41f8d348b90d | 135 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 136 | ledD12=1; |
WelzAlex | 0:41f8d348b90d | 137 | |
WelzAlex | 0:41f8d348b90d | 138 | WSLI=1; |
WelzAlex | 0:41f8d348b90d | 139 | WSRE=1; |
WelzAlex | 0:41f8d348b90d | 140 | |
WelzAlex | 0:41f8d348b90d | 141 | i++; |
WelzAlex | 0:41f8d348b90d | 142 | } |
WelzAlex | 0:41f8d348b90d | 143 | |
WelzAlex | 0:41f8d348b90d | 144 | |
WelzAlex | 0:41f8d348b90d | 145 | MG1_F=MG2_F=0; |
WelzAlex | 0:41f8d348b90d | 146 | wait(0.1); |
WelzAlex | 0:41f8d348b90d | 147 | MG1_R=MG2_R=1; |
WelzAlex | 0:41f8d348b90d | 148 | |
WelzAlex | 0:41f8d348b90d | 149 | |
WelzAlex | 0:41f8d348b90d | 150 | //LED rechts nach links |
WelzAlex | 0:41f8d348b90d | 151 | while(a<1) |
WelzAlex | 0:41f8d348b90d | 152 | { |
WelzAlex | 0:41f8d348b90d | 153 | |
WelzAlex | 0:41f8d348b90d | 154 | RTREHI=0;//Rot rechts hinten |
WelzAlex | 0:41f8d348b90d | 155 | RTLIHI=0; //rot links hinten |
WelzAlex | 0:41f8d348b90d | 156 | |
WelzAlex | 0:41f8d348b90d | 157 | ledD12=0; |
WelzAlex | 0:41f8d348b90d | 158 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 159 | ledD12=1; |
WelzAlex | 0:41f8d348b90d | 160 | |
WelzAlex | 0:41f8d348b90d | 161 | |
WelzAlex | 0:41f8d348b90d | 162 | |
WelzAlex | 0:41f8d348b90d | 163 | ledD13=0; |
WelzAlex | 0:41f8d348b90d | 164 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 165 | ledD13=1; |
WelzAlex | 0:41f8d348b90d | 166 | |
WelzAlex | 0:41f8d348b90d | 167 | |
WelzAlex | 0:41f8d348b90d | 168 | |
WelzAlex | 0:41f8d348b90d | 169 | |
WelzAlex | 0:41f8d348b90d | 170 | ledD11=0; |
WelzAlex | 0:41f8d348b90d | 171 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 172 | ledD11=1; |
WelzAlex | 0:41f8d348b90d | 173 | |
WelzAlex | 0:41f8d348b90d | 174 | |
WelzAlex | 0:41f8d348b90d | 175 | |
WelzAlex | 0:41f8d348b90d | 176 | ledD10=0; |
WelzAlex | 0:41f8d348b90d | 177 | wait(0.2); |
WelzAlex | 0:41f8d348b90d | 178 | ledD10=1; |
WelzAlex | 0:41f8d348b90d | 179 | |
WelzAlex | 0:41f8d348b90d | 180 | RTREHI=1;//Rot rechts hinten |
WelzAlex | 0:41f8d348b90d | 181 | RTLIHI=1; //rot links hinten |
WelzAlex | 0:41f8d348b90d | 182 | |
WelzAlex | 0:41f8d348b90d | 183 | a++; |
WelzAlex | 0:41f8d348b90d | 184 | } |
WelzAlex | 0:41f8d348b90d | 185 | |
WelzAlex | 0:41f8d348b90d | 186 | |
WelzAlex | 0:41f8d348b90d | 187 | |
WelzAlex | 0:41f8d348b90d | 188 | MG1_R=MG2_R=0; |
WelzAlex | 0:41f8d348b90d | 189 | wait(0.75); |
WelzAlex | 0:41f8d348b90d | 190 | |
WelzAlex | 0:41f8d348b90d | 191 | //Blinker Rechts Vorn/Hinten |
WelzAlex | 0:41f8d348b90d | 192 | while(b<2) |
WelzAlex | 0:41f8d348b90d | 193 | { |
WelzAlex | 0:41f8d348b90d | 194 | GEREVO=0; |
WelzAlex | 0:41f8d348b90d | 195 | GEREHI=0; |
WelzAlex | 0:41f8d348b90d | 196 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 197 | GEREVO=1; |
WelzAlex | 0:41f8d348b90d | 198 | GEREHI=1; |
WelzAlex | 0:41f8d348b90d | 199 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 200 | GEREVO=0; |
WelzAlex | 0:41f8d348b90d | 201 | GEREHI=0; |
WelzAlex | 0:41f8d348b90d | 202 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 203 | GEREVO=1; |
WelzAlex | 0:41f8d348b90d | 204 | GEREHI=1; |
WelzAlex | 0:41f8d348b90d | 205 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 206 | GEREVO=0; |
WelzAlex | 0:41f8d348b90d | 207 | GEREHI=0; |
WelzAlex | 0:41f8d348b90d | 208 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 209 | GEREVO=1; |
WelzAlex | 0:41f8d348b90d | 210 | GEREHI=1; |
WelzAlex | 0:41f8d348b90d | 211 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 212 | b++; |
WelzAlex | 0:41f8d348b90d | 213 | } |
WelzAlex | 0:41f8d348b90d | 214 | |
WelzAlex | 0:41f8d348b90d | 215 | //90° Drehung (rechts) |
WelzAlex | 0:41f8d348b90d | 216 | MG1_F=MG2_R=1; |
WelzAlex | 0:41f8d348b90d | 217 | |
WelzAlex | 0:41f8d348b90d | 218 | wait(0.5555555); |
WelzAlex | 0:41f8d348b90d | 219 | |
WelzAlex | 0:41f8d348b90d | 220 | MG1_F=MG2_R=0; |
WelzAlex | 0:41f8d348b90d | 221 | wait(0.5); |
WelzAlex | 0:41f8d348b90d | 222 | |
WelzAlex | 0:41f8d348b90d | 223 | c++; |
WelzAlex | 0:41f8d348b90d | 224 | } |
WelzAlex | 0:41f8d348b90d | 225 | |
WelzAlex | 0:41f8d348b90d | 226 | |
WelzAlex | 0:41f8d348b90d | 227 | |
WelzAlex | 0:41f8d348b90d | 228 | |
WelzAlex | 0:41f8d348b90d | 229 | |
WelzAlex | 0:41f8d348b90d | 230 | |
WelzAlex | 0:41f8d348b90d | 231 | //2 Schleife (vor-zurück-90°links) |
WelzAlex | 0:41f8d348b90d | 232 | while(d<1) |
WelzAlex | 0:41f8d348b90d | 233 | { |
WelzAlex | 0:41f8d348b90d | 234 | int i = 0; |
WelzAlex | 0:41f8d348b90d | 235 | int a = 0; |
WelzAlex | 0:41f8d348b90d | 236 | int b = 0; |
WelzAlex | 0:41f8d348b90d | 237 | MG1_F=MG2_F=1; |
WelzAlex | 0:41f8d348b90d | 238 | |
WelzAlex | 0:41f8d348b90d | 239 | //LED links nach rechts |
WelzAlex | 0:41f8d348b90d | 240 | while(i<1) |
WelzAlex | 0:41f8d348b90d | 241 | { |
WelzAlex | 0:41f8d348b90d | 242 | |
WelzAlex | 0:41f8d348b90d | 243 | WSLI=0; |
WelzAlex | 0:41f8d348b90d | 244 | WSRE=0; |
WelzAlex | 0:41f8d348b90d | 245 | ledD10=0; |
WelzAlex | 0:41f8d348b90d | 246 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 247 | ledD10=1; |
WelzAlex | 0:41f8d348b90d | 248 | |
WelzAlex | 0:41f8d348b90d | 249 | |
WelzAlex | 0:41f8d348b90d | 250 | |
WelzAlex | 0:41f8d348b90d | 251 | ledD11=0; |
WelzAlex | 0:41f8d348b90d | 252 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 253 | ledD11=1; |
WelzAlex | 0:41f8d348b90d | 254 | |
WelzAlex | 0:41f8d348b90d | 255 | |
WelzAlex | 0:41f8d348b90d | 256 | |
WelzAlex | 0:41f8d348b90d | 257 | |
WelzAlex | 0:41f8d348b90d | 258 | ledD13=0; |
WelzAlex | 0:41f8d348b90d | 259 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 260 | ledD13=1; |
WelzAlex | 0:41f8d348b90d | 261 | |
WelzAlex | 0:41f8d348b90d | 262 | |
WelzAlex | 0:41f8d348b90d | 263 | |
WelzAlex | 0:41f8d348b90d | 264 | ledD12=0; |
WelzAlex | 0:41f8d348b90d | 265 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 266 | ledD12=1; |
WelzAlex | 0:41f8d348b90d | 267 | |
WelzAlex | 0:41f8d348b90d | 268 | WSLI=1; |
WelzAlex | 0:41f8d348b90d | 269 | WSRE=1; |
WelzAlex | 0:41f8d348b90d | 270 | |
WelzAlex | 0:41f8d348b90d | 271 | i++; |
WelzAlex | 0:41f8d348b90d | 272 | } |
WelzAlex | 0:41f8d348b90d | 273 | |
WelzAlex | 0:41f8d348b90d | 274 | |
WelzAlex | 0:41f8d348b90d | 275 | MG1_F=MG2_F=0; |
WelzAlex | 0:41f8d348b90d | 276 | wait(0.1); |
WelzAlex | 0:41f8d348b90d | 277 | MG1_R=MG2_R=1; |
WelzAlex | 0:41f8d348b90d | 278 | |
WelzAlex | 0:41f8d348b90d | 279 | |
WelzAlex | 0:41f8d348b90d | 280 | //LED rechts nach links |
WelzAlex | 0:41f8d348b90d | 281 | while(a<1) |
WelzAlex | 0:41f8d348b90d | 282 | { |
WelzAlex | 0:41f8d348b90d | 283 | |
WelzAlex | 0:41f8d348b90d | 284 | RTREHI=0;//Rot rechts hinten |
WelzAlex | 0:41f8d348b90d | 285 | RTLIHI=0; //rot links hinten |
WelzAlex | 0:41f8d348b90d | 286 | |
WelzAlex | 0:41f8d348b90d | 287 | ledD12=0; |
WelzAlex | 0:41f8d348b90d | 288 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 289 | ledD12=1; |
WelzAlex | 0:41f8d348b90d | 290 | |
WelzAlex | 0:41f8d348b90d | 291 | |
WelzAlex | 0:41f8d348b90d | 292 | |
WelzAlex | 0:41f8d348b90d | 293 | ledD13=0; |
WelzAlex | 0:41f8d348b90d | 294 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 295 | ledD13=1; |
WelzAlex | 0:41f8d348b90d | 296 | |
WelzAlex | 0:41f8d348b90d | 297 | |
WelzAlex | 0:41f8d348b90d | 298 | |
WelzAlex | 0:41f8d348b90d | 299 | |
WelzAlex | 0:41f8d348b90d | 300 | ledD11=0; |
WelzAlex | 0:41f8d348b90d | 301 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 302 | ledD11=1; |
WelzAlex | 0:41f8d348b90d | 303 | |
WelzAlex | 0:41f8d348b90d | 304 | |
WelzAlex | 0:41f8d348b90d | 305 | |
WelzAlex | 0:41f8d348b90d | 306 | ledD10=0; |
WelzAlex | 0:41f8d348b90d | 307 | wait(0.2); |
WelzAlex | 0:41f8d348b90d | 308 | ledD10=1; |
WelzAlex | 0:41f8d348b90d | 309 | |
WelzAlex | 0:41f8d348b90d | 310 | RTREHI=1;//Rot rechts hinten |
WelzAlex | 0:41f8d348b90d | 311 | RTLIHI=1; //rot links hinten |
WelzAlex | 0:41f8d348b90d | 312 | |
WelzAlex | 0:41f8d348b90d | 313 | a++; |
WelzAlex | 0:41f8d348b90d | 314 | } |
WelzAlex | 0:41f8d348b90d | 315 | |
WelzAlex | 0:41f8d348b90d | 316 | |
WelzAlex | 0:41f8d348b90d | 317 | |
WelzAlex | 0:41f8d348b90d | 318 | MG1_R=MG2_R=0; |
WelzAlex | 0:41f8d348b90d | 319 | wait(0.75); |
WelzAlex | 0:41f8d348b90d | 320 | |
WelzAlex | 0:41f8d348b90d | 321 | //Blinker Links Vorn/Hinten |
WelzAlex | 0:41f8d348b90d | 322 | while(b<2) |
WelzAlex | 0:41f8d348b90d | 323 | { |
WelzAlex | 0:41f8d348b90d | 324 | GELIVO=0; |
WelzAlex | 0:41f8d348b90d | 325 | GELIHI=0; |
WelzAlex | 0:41f8d348b90d | 326 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 327 | GELIVO=1; |
WelzAlex | 0:41f8d348b90d | 328 | GELIHI=1; |
WelzAlex | 0:41f8d348b90d | 329 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 330 | GELIVO=0; |
WelzAlex | 0:41f8d348b90d | 331 | GELIHI=0; |
WelzAlex | 0:41f8d348b90d | 332 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 333 | GELIVO=1; |
WelzAlex | 0:41f8d348b90d | 334 | GELIHI=1; |
WelzAlex | 0:41f8d348b90d | 335 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 336 | GELIVO=0; |
WelzAlex | 0:41f8d348b90d | 337 | GELIHI=0; |
WelzAlex | 0:41f8d348b90d | 338 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 339 | GELIVO=1; |
WelzAlex | 0:41f8d348b90d | 340 | GELIHI=1; |
WelzAlex | 0:41f8d348b90d | 341 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 342 | b++; |
WelzAlex | 0:41f8d348b90d | 343 | } |
WelzAlex | 0:41f8d348b90d | 344 | |
WelzAlex | 0:41f8d348b90d | 345 | //90° Drehung (links) |
WelzAlex | 0:41f8d348b90d | 346 | MG1_R=MG2_F=1; |
WelzAlex | 0:41f8d348b90d | 347 | |
WelzAlex | 0:41f8d348b90d | 348 | wait(0.5555555); |
WelzAlex | 0:41f8d348b90d | 349 | |
WelzAlex | 0:41f8d348b90d | 350 | MG1_R=MG2_F=0; |
WelzAlex | 0:41f8d348b90d | 351 | wait(0.5); |
WelzAlex | 0:41f8d348b90d | 352 | |
WelzAlex | 0:41f8d348b90d | 353 | d++; |
WelzAlex | 0:41f8d348b90d | 354 | } |
WelzAlex | 0:41f8d348b90d | 355 | |
WelzAlex | 0:41f8d348b90d | 356 | //3.Schleife (zurück-vor-90°links) |
WelzAlex | 0:41f8d348b90d | 357 | while(e<1) |
WelzAlex | 0:41f8d348b90d | 358 | { |
WelzAlex | 0:41f8d348b90d | 359 | int i = 0; |
WelzAlex | 0:41f8d348b90d | 360 | int a = 0; |
WelzAlex | 0:41f8d348b90d | 361 | int b = 0; |
WelzAlex | 0:41f8d348b90d | 362 | |
WelzAlex | 0:41f8d348b90d | 363 | MG1_R=MG2_R=1; |
WelzAlex | 0:41f8d348b90d | 364 | |
WelzAlex | 0:41f8d348b90d | 365 | //LED rechts nach links |
WelzAlex | 0:41f8d348b90d | 366 | while(a<1) |
WelzAlex | 0:41f8d348b90d | 367 | { |
WelzAlex | 0:41f8d348b90d | 368 | |
WelzAlex | 0:41f8d348b90d | 369 | RTREHI=0;//Rot rechts hinten |
WelzAlex | 0:41f8d348b90d | 370 | RTLIHI=0; //rot links hinten |
WelzAlex | 0:41f8d348b90d | 371 | |
WelzAlex | 0:41f8d348b90d | 372 | ledD12=0; |
WelzAlex | 0:41f8d348b90d | 373 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 374 | ledD12=1; |
WelzAlex | 0:41f8d348b90d | 375 | |
WelzAlex | 0:41f8d348b90d | 376 | |
WelzAlex | 0:41f8d348b90d | 377 | |
WelzAlex | 0:41f8d348b90d | 378 | ledD13=0; |
WelzAlex | 0:41f8d348b90d | 379 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 380 | ledD13=1; |
WelzAlex | 0:41f8d348b90d | 381 | |
WelzAlex | 0:41f8d348b90d | 382 | |
WelzAlex | 0:41f8d348b90d | 383 | |
WelzAlex | 0:41f8d348b90d | 384 | |
WelzAlex | 0:41f8d348b90d | 385 | ledD11=0; |
WelzAlex | 0:41f8d348b90d | 386 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 387 | ledD11=1; |
WelzAlex | 0:41f8d348b90d | 388 | |
WelzAlex | 0:41f8d348b90d | 389 | |
WelzAlex | 0:41f8d348b90d | 390 | |
WelzAlex | 0:41f8d348b90d | 391 | ledD10=0; |
WelzAlex | 0:41f8d348b90d | 392 | wait(0.2); |
WelzAlex | 0:41f8d348b90d | 393 | ledD10=1; |
WelzAlex | 0:41f8d348b90d | 394 | |
WelzAlex | 0:41f8d348b90d | 395 | RTREHI=1;//Rot rechts hinten |
WelzAlex | 0:41f8d348b90d | 396 | RTLIHI=1; //rot links hinten |
WelzAlex | 0:41f8d348b90d | 397 | |
WelzAlex | 0:41f8d348b90d | 398 | a++; |
WelzAlex | 0:41f8d348b90d | 399 | } |
WelzAlex | 0:41f8d348b90d | 400 | |
WelzAlex | 0:41f8d348b90d | 401 | |
WelzAlex | 0:41f8d348b90d | 402 | |
WelzAlex | 0:41f8d348b90d | 403 | MG1_R=MG2_R=0; |
WelzAlex | 0:41f8d348b90d | 404 | wait(0.1); |
WelzAlex | 0:41f8d348b90d | 405 | MG1_F=MG2_F=1; |
WelzAlex | 0:41f8d348b90d | 406 | |
WelzAlex | 0:41f8d348b90d | 407 | |
WelzAlex | 0:41f8d348b90d | 408 | //LED links nach rechts |
WelzAlex | 0:41f8d348b90d | 409 | while(i<1) |
WelzAlex | 0:41f8d348b90d | 410 | { |
WelzAlex | 0:41f8d348b90d | 411 | |
WelzAlex | 0:41f8d348b90d | 412 | WSLI=0; |
WelzAlex | 0:41f8d348b90d | 413 | WSRE=0; |
WelzAlex | 0:41f8d348b90d | 414 | ledD10=0; |
WelzAlex | 0:41f8d348b90d | 415 | wait(0.2); |
WelzAlex | 0:41f8d348b90d | 416 | ledD10=1; |
WelzAlex | 0:41f8d348b90d | 417 | |
WelzAlex | 0:41f8d348b90d | 418 | |
WelzAlex | 0:41f8d348b90d | 419 | |
WelzAlex | 0:41f8d348b90d | 420 | ledD11=0; |
WelzAlex | 0:41f8d348b90d | 421 | wait(0.2); |
WelzAlex | 0:41f8d348b90d | 422 | ledD11=1; |
WelzAlex | 0:41f8d348b90d | 423 | |
WelzAlex | 0:41f8d348b90d | 424 | |
WelzAlex | 0:41f8d348b90d | 425 | |
WelzAlex | 0:41f8d348b90d | 426 | |
WelzAlex | 0:41f8d348b90d | 427 | ledD13=0; |
WelzAlex | 0:41f8d348b90d | 428 | wait(0.2); |
WelzAlex | 0:41f8d348b90d | 429 | ledD13=1; |
WelzAlex | 0:41f8d348b90d | 430 | |
WelzAlex | 0:41f8d348b90d | 431 | |
WelzAlex | 0:41f8d348b90d | 432 | |
WelzAlex | 0:41f8d348b90d | 433 | ledD12=0; |
WelzAlex | 0:41f8d348b90d | 434 | wait(0.2); |
WelzAlex | 0:41f8d348b90d | 435 | ledD12=1; |
WelzAlex | 0:41f8d348b90d | 436 | |
WelzAlex | 0:41f8d348b90d | 437 | WSLI=1; |
WelzAlex | 0:41f8d348b90d | 438 | WSRE=1; |
WelzAlex | 0:41f8d348b90d | 439 | |
WelzAlex | 0:41f8d348b90d | 440 | i++; |
WelzAlex | 0:41f8d348b90d | 441 | } |
WelzAlex | 0:41f8d348b90d | 442 | |
WelzAlex | 0:41f8d348b90d | 443 | |
WelzAlex | 0:41f8d348b90d | 444 | MG1_F=MG2_F=0; |
WelzAlex | 0:41f8d348b90d | 445 | wait(0.75); |
WelzAlex | 0:41f8d348b90d | 446 | |
WelzAlex | 0:41f8d348b90d | 447 | |
WelzAlex | 0:41f8d348b90d | 448 | |
WelzAlex | 0:41f8d348b90d | 449 | //Blinker Rechts Vorn/Hinten |
WelzAlex | 0:41f8d348b90d | 450 | while(b<2) |
WelzAlex | 0:41f8d348b90d | 451 | { |
WelzAlex | 0:41f8d348b90d | 452 | GEREVO=0; |
WelzAlex | 0:41f8d348b90d | 453 | GEREHI=0; |
WelzAlex | 0:41f8d348b90d | 454 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 455 | GEREVO=1; |
WelzAlex | 0:41f8d348b90d | 456 | GEREHI=1; |
WelzAlex | 0:41f8d348b90d | 457 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 458 | GEREVO=0; |
WelzAlex | 0:41f8d348b90d | 459 | GEREHI=0; |
WelzAlex | 0:41f8d348b90d | 460 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 461 | GEREVO=1; |
WelzAlex | 0:41f8d348b90d | 462 | GEREHI=1; |
WelzAlex | 0:41f8d348b90d | 463 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 464 | GEREVO=0; |
WelzAlex | 0:41f8d348b90d | 465 | GEREHI=0; |
WelzAlex | 0:41f8d348b90d | 466 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 467 | GEREVO=1; |
WelzAlex | 0:41f8d348b90d | 468 | GEREHI=1; |
WelzAlex | 0:41f8d348b90d | 469 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 470 | b++; |
WelzAlex | 0:41f8d348b90d | 471 | } |
WelzAlex | 0:41f8d348b90d | 472 | |
WelzAlex | 0:41f8d348b90d | 473 | //90° Drehung (rechts) |
WelzAlex | 0:41f8d348b90d | 474 | MG1_F=MG2_R=1; |
WelzAlex | 0:41f8d348b90d | 475 | |
WelzAlex | 0:41f8d348b90d | 476 | wait(0.5555555); |
WelzAlex | 0:41f8d348b90d | 477 | |
WelzAlex | 0:41f8d348b90d | 478 | MG1_F=MG2_R=0; |
WelzAlex | 0:41f8d348b90d | 479 | wait(0.5); |
WelzAlex | 0:41f8d348b90d | 480 | |
WelzAlex | 0:41f8d348b90d | 481 | e++; |
WelzAlex | 0:41f8d348b90d | 482 | } |
WelzAlex | 0:41f8d348b90d | 483 | |
WelzAlex | 0:41f8d348b90d | 484 | //4.Schleife (zurück-vorn-90°links) |
WelzAlex | 0:41f8d348b90d | 485 | while(f<1) |
WelzAlex | 0:41f8d348b90d | 486 | { |
WelzAlex | 0:41f8d348b90d | 487 | int i = 0; |
WelzAlex | 0:41f8d348b90d | 488 | int a = 0; |
WelzAlex | 0:41f8d348b90d | 489 | int b = 0; |
WelzAlex | 0:41f8d348b90d | 490 | MG1_R=MG2_R=1; |
WelzAlex | 0:41f8d348b90d | 491 | |
WelzAlex | 0:41f8d348b90d | 492 | //LED rechts nach links |
WelzAlex | 0:41f8d348b90d | 493 | while(a<1) |
WelzAlex | 0:41f8d348b90d | 494 | { |
WelzAlex | 0:41f8d348b90d | 495 | |
WelzAlex | 0:41f8d348b90d | 496 | RTREHI=0;//Rot rechts hinten |
WelzAlex | 0:41f8d348b90d | 497 | RTLIHI=0; //rot links hinten |
WelzAlex | 0:41f8d348b90d | 498 | |
WelzAlex | 0:41f8d348b90d | 499 | ledD12=0; |
WelzAlex | 0:41f8d348b90d | 500 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 501 | ledD12=1; |
WelzAlex | 0:41f8d348b90d | 502 | |
WelzAlex | 0:41f8d348b90d | 503 | |
WelzAlex | 0:41f8d348b90d | 504 | |
WelzAlex | 0:41f8d348b90d | 505 | ledD13=0; |
WelzAlex | 0:41f8d348b90d | 506 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 507 | ledD13=1; |
WelzAlex | 0:41f8d348b90d | 508 | |
WelzAlex | 0:41f8d348b90d | 509 | |
WelzAlex | 0:41f8d348b90d | 510 | |
WelzAlex | 0:41f8d348b90d | 511 | |
WelzAlex | 0:41f8d348b90d | 512 | ledD11=0; |
WelzAlex | 0:41f8d348b90d | 513 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 514 | ledD11=1; |
WelzAlex | 0:41f8d348b90d | 515 | |
WelzAlex | 0:41f8d348b90d | 516 | |
WelzAlex | 0:41f8d348b90d | 517 | |
WelzAlex | 0:41f8d348b90d | 518 | ledD10=0; |
WelzAlex | 0:41f8d348b90d | 519 | wait(0.2); |
WelzAlex | 0:41f8d348b90d | 520 | ledD10=1; |
WelzAlex | 0:41f8d348b90d | 521 | |
WelzAlex | 0:41f8d348b90d | 522 | RTREHI=1;//Rot rechts hinten |
WelzAlex | 0:41f8d348b90d | 523 | RTLIHI=1; //rot links hinten |
WelzAlex | 0:41f8d348b90d | 524 | |
WelzAlex | 0:41f8d348b90d | 525 | a++; |
WelzAlex | 0:41f8d348b90d | 526 | } |
WelzAlex | 0:41f8d348b90d | 527 | |
WelzAlex | 0:41f8d348b90d | 528 | MG1_R=MG2_R=0; |
WelzAlex | 0:41f8d348b90d | 529 | wait(0.1); |
WelzAlex | 0:41f8d348b90d | 530 | MG1_F=MG2_F=1; |
WelzAlex | 0:41f8d348b90d | 531 | |
WelzAlex | 0:41f8d348b90d | 532 | //LED links nach rechts |
WelzAlex | 0:41f8d348b90d | 533 | while(i<1) |
WelzAlex | 0:41f8d348b90d | 534 | { |
WelzAlex | 0:41f8d348b90d | 535 | |
WelzAlex | 0:41f8d348b90d | 536 | WSLI=0; |
WelzAlex | 0:41f8d348b90d | 537 | WSRE=0; |
WelzAlex | 0:41f8d348b90d | 538 | ledD10=0; |
WelzAlex | 0:41f8d348b90d | 539 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 540 | ledD10=1; |
WelzAlex | 0:41f8d348b90d | 541 | |
WelzAlex | 0:41f8d348b90d | 542 | |
WelzAlex | 0:41f8d348b90d | 543 | |
WelzAlex | 0:41f8d348b90d | 544 | ledD11=0; |
WelzAlex | 0:41f8d348b90d | 545 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 546 | ledD11=1; |
WelzAlex | 0:41f8d348b90d | 547 | |
WelzAlex | 0:41f8d348b90d | 548 | |
WelzAlex | 0:41f8d348b90d | 549 | |
WelzAlex | 0:41f8d348b90d | 550 | |
WelzAlex | 0:41f8d348b90d | 551 | ledD13=0; |
WelzAlex | 0:41f8d348b90d | 552 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 553 | ledD13=1; |
WelzAlex | 0:41f8d348b90d | 554 | |
WelzAlex | 0:41f8d348b90d | 555 | |
WelzAlex | 0:41f8d348b90d | 556 | |
WelzAlex | 0:41f8d348b90d | 557 | ledD12=0; |
WelzAlex | 0:41f8d348b90d | 558 | wait (0.2); |
WelzAlex | 0:41f8d348b90d | 559 | ledD12=1; |
WelzAlex | 0:41f8d348b90d | 560 | |
WelzAlex | 0:41f8d348b90d | 561 | WSLI=1; |
WelzAlex | 0:41f8d348b90d | 562 | WSRE=1; |
WelzAlex | 0:41f8d348b90d | 563 | |
WelzAlex | 0:41f8d348b90d | 564 | i++; |
WelzAlex | 0:41f8d348b90d | 565 | } |
WelzAlex | 0:41f8d348b90d | 566 | |
WelzAlex | 0:41f8d348b90d | 567 | |
WelzAlex | 0:41f8d348b90d | 568 | MG1_F=MG2_F=0; |
WelzAlex | 0:41f8d348b90d | 569 | wait(0.75); |
WelzAlex | 0:41f8d348b90d | 570 | |
WelzAlex | 0:41f8d348b90d | 571 | //Blinker Links Vorn/Hinten |
WelzAlex | 0:41f8d348b90d | 572 | while(b<2) |
WelzAlex | 0:41f8d348b90d | 573 | { |
WelzAlex | 0:41f8d348b90d | 574 | GELIVO=0; |
WelzAlex | 0:41f8d348b90d | 575 | GELIHI=0; |
WelzAlex | 0:41f8d348b90d | 576 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 577 | GELIVO=1; |
WelzAlex | 0:41f8d348b90d | 578 | GELIHI=1; |
WelzAlex | 0:41f8d348b90d | 579 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 580 | GELIVO=0; |
WelzAlex | 0:41f8d348b90d | 581 | GELIHI=0; |
WelzAlex | 0:41f8d348b90d | 582 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 583 | GELIVO=1; |
WelzAlex | 0:41f8d348b90d | 584 | GELIHI=1; |
WelzAlex | 0:41f8d348b90d | 585 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 586 | GELIVO=0; |
WelzAlex | 0:41f8d348b90d | 587 | GELIHI=0; |
WelzAlex | 0:41f8d348b90d | 588 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 589 | GELIVO=1; |
WelzAlex | 0:41f8d348b90d | 590 | GELIHI=1; |
WelzAlex | 0:41f8d348b90d | 591 | wait(0.05); |
WelzAlex | 0:41f8d348b90d | 592 | b++; |
WelzAlex | 0:41f8d348b90d | 593 | } |
WelzAlex | 0:41f8d348b90d | 594 | |
WelzAlex | 0:41f8d348b90d | 595 | //90° Drehung (links) |
WelzAlex | 0:41f8d348b90d | 596 | MG1_R=MG2_F=1; |
WelzAlex | 0:41f8d348b90d | 597 | |
WelzAlex | 0:41f8d348b90d | 598 | wait(0.5555555); |
WelzAlex | 0:41f8d348b90d | 599 | |
WelzAlex | 0:41f8d348b90d | 600 | MG1_R=MG2_F=0; |
WelzAlex | 0:41f8d348b90d | 601 | wait(0.5); |
WelzAlex | 0:41f8d348b90d | 602 | |
WelzAlex | 0:41f8d348b90d | 603 | f++; |
WelzAlex | 0:41f8d348b90d | 604 | } |
WelzAlex | 0:41f8d348b90d | 605 | |
WelzAlex | 0:41f8d348b90d | 606 | |
WelzAlex | 0:41f8d348b90d | 607 | |
WelzAlex | 0:41f8d348b90d | 608 | |
WelzAlex | 0:41f8d348b90d | 609 | |
WelzAlex | 0:41f8d348b90d | 610 | |
WelzAlex | 0:41f8d348b90d | 611 | |
WelzAlex | 0:41f8d348b90d | 612 | } |
WelzAlex | 0:41f8d348b90d | 613 | |
WelzAlex | 0:41f8d348b90d | 614 | |
WelzAlex | 0:41f8d348b90d | 615 | |
WelzAlex | 0:41f8d348b90d | 616 | |
WelzAlex | 0:41f8d348b90d | 617 | } |