Martin Werluschnig
/
BertlVorZurueck
BertlVorZurueck
BertlVorZurueck.cpp@0:dcd423180481, 2018-11-15 (annotated)
- Committer:
- martwerl
- Date:
- Thu Nov 15 17:51:17 2018 +0000
- Revision:
- 0:dcd423180481
BertlVorZurueck
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
martwerl | 0:dcd423180481 | 1 | #include "mbed.h" |
martwerl | 0:dcd423180481 | 2 | #include "Serial_HL.h" |
martwerl | 0:dcd423180481 | 3 | #include "Bertl14.h" |
martwerl | 0:dcd423180481 | 4 | #include "BertlObjects.h" |
martwerl | 0:dcd423180481 | 5 | |
martwerl | 0:dcd423180481 | 6 | // main=2^0 LS ENC 2^2 |
martwerl | 0:dcd423180481 | 7 | BusOut boardPow(p30, P1_6, P1_7); |
martwerl | 0:dcd423180481 | 8 | |
martwerl | 0:dcd423180481 | 9 | // ls5 nur beim Betrl15 |
martwerl | 0:dcd423180481 | 10 | // AnalogInHL ls1(p18), ls2(p16), ls3(p19), ls4(p17); // B14 |
martwerl | 0:dcd423180481 | 11 | |
martwerl | 0:dcd423180481 | 12 | //AnalogInHL ls1(p18), ls2(p16), ls3(p20), ls4(p19), ls5(p17); // B15 |
martwerl | 0:dcd423180481 | 13 | //void ButonBlinker(); |
martwerl | 0:dcd423180481 | 14 | |
martwerl | 0:dcd423180481 | 15 | //void MotorTest (); |
martwerl | 0:dcd423180481 | 16 | |
martwerl | 0:dcd423180481 | 17 | void BackW (); |
martwerl | 0:dcd423180481 | 18 | void ForW (); |
martwerl | 0:dcd423180481 | 19 | |
martwerl | 0:dcd423180481 | 20 | |
martwerl | 0:dcd423180481 | 21 | |
martwerl | 0:dcd423180481 | 22 | int main(void) |
martwerl | 0:dcd423180481 | 23 | { |
martwerl | 0:dcd423180481 | 24 | boardPow=1; wait_ms(10); |
martwerl | 0:dcd423180481 | 25 | InitBertl(); |
martwerl | 0:dcd423180481 | 26 | pex.useISR=0; leds=9; |
martwerl | 0:dcd423180481 | 27 | pex.ClearLeds(); |
martwerl | 0:dcd423180481 | 28 | |
martwerl | 0:dcd423180481 | 29 | pex.WaitUntilButtonPressed(); |
martwerl | 0:dcd423180481 | 30 | while(1) |
martwerl | 0:dcd423180481 | 31 | { |
martwerl | 0:dcd423180481 | 32 | //ButonBlinker(); |
martwerl | 0:dcd423180481 | 33 | //MotorTest (); |
martwerl | 0:dcd423180481 | 34 | BackW (); |
martwerl | 0:dcd423180481 | 35 | wait_ms(1000); |
martwerl | 0:dcd423180481 | 36 | ForW (); |
martwerl | 0:dcd423180481 | 37 | wait_ms(1000); |
martwerl | 0:dcd423180481 | 38 | } |
martwerl | 0:dcd423180481 | 39 | |
martwerl | 0:dcd423180481 | 40 | return 1; |
martwerl | 0:dcd423180481 | 41 | } |
martwerl | 0:dcd423180481 | 42 | /* |
martwerl | 0:dcd423180481 | 43 | void ButonBlinker() |
martwerl | 0:dcd423180481 | 44 | { |
martwerl | 0:dcd423180481 | 45 | pex.ReadButtons(); |
martwerl | 0:dcd423180481 | 46 | |
martwerl | 0:dcd423180481 | 47 | if (pex.IsButton(BTN_FLL)) |
martwerl | 0:dcd423180481 | 48 | { |
martwerl | 0:dcd423180481 | 49 | pex.SetLeds(LED_FL1|LED_FL2); |
martwerl | 0:dcd423180481 | 50 | } |
martwerl | 0:dcd423180481 | 51 | |
martwerl | 0:dcd423180481 | 52 | if (pex.IsButton(BTN_FRR)) |
martwerl | 0:dcd423180481 | 53 | { |
martwerl | 0:dcd423180481 | 54 | pex.SetLeds(LED_FR1|LED_FR2); |
martwerl | 0:dcd423180481 | 55 | } |
martwerl | 0:dcd423180481 | 56 | wait_ms(100); |
martwerl | 0:dcd423180481 | 57 | pex.ClearLeds(); |
martwerl | 0:dcd423180481 | 58 | wait_ms(100); |
martwerl | 0:dcd423180481 | 59 | } |
martwerl | 0:dcd423180481 | 60 | */ |
martwerl | 0:dcd423180481 | 61 | |
martwerl | 0:dcd423180481 | 62 | /* |
martwerl | 0:dcd423180481 | 63 | void MotorTest () |
martwerl | 0:dcd423180481 | 64 | { |
martwerl | 0:dcd423180481 | 65 | if (pex.IsButton(BTN_FRR||BTN_FLL)) |
martwerl | 0:dcd423180481 | 66 | { |
martwerl | 0:dcd423180481 | 67 | mL.SetPow(-0.2); |
martwerl | 0:dcd423180481 | 68 | mR.SetPow(-0.2); |
martwerl | 0:dcd423180481 | 69 | } |
martwerl | 0:dcd423180481 | 70 | |
martwerl | 0:dcd423180481 | 71 | |
martwerl | 0:dcd423180481 | 72 | else if (pex.IsButton(BTN_BR||BTN_BL)) |
martwerl | 0:dcd423180481 | 73 | { |
martwerl | 0:dcd423180481 | 74 | mL.SetPow(0.2); |
martwerl | 0:dcd423180481 | 75 | mR.SetPow(0.2); |
martwerl | 0:dcd423180481 | 76 | } |
martwerl | 0:dcd423180481 | 77 | |
martwerl | 0:dcd423180481 | 78 | //mL.SetPow(0.2); |
martwerl | 0:dcd423180481 | 79 | //mR.SetPow(0.2); |
martwerl | 0:dcd423180481 | 80 | |
martwerl | 0:dcd423180481 | 81 | //wait_ms(2000); |
martwerl | 0:dcd423180481 | 82 | |
martwerl | 0:dcd423180481 | 83 | //mL.SetPow(-0.2); |
martwerl | 0:dcd423180481 | 84 | //mR.SetPow(-0.2); |
martwerl | 0:dcd423180481 | 85 | |
martwerl | 0:dcd423180481 | 86 | //wait_ms(2000); |
martwerl | 0:dcd423180481 | 87 | |
martwerl | 0:dcd423180481 | 88 | |
martwerl | 0:dcd423180481 | 89 | |
martwerl | 0:dcd423180481 | 90 | |
martwerl | 0:dcd423180481 | 91 | } |
martwerl | 0:dcd423180481 | 92 | */ |
martwerl | 0:dcd423180481 | 93 | |
martwerl | 0:dcd423180481 | 94 | void BackW () |
martwerl | 0:dcd423180481 | 95 | { |
martwerl | 0:dcd423180481 | 96 | mL.SetPow(-0.3); |
martwerl | 0:dcd423180481 | 97 | mR.SetPow(-0.3); |
martwerl | 0:dcd423180481 | 98 | |
martwerl | 0:dcd423180481 | 99 | while (1 ) |
martwerl | 0:dcd423180481 | 100 | { |
martwerl | 0:dcd423180481 | 101 | pex.ReadButtons(); |
martwerl | 0:dcd423180481 | 102 | |
martwerl | 0:dcd423180481 | 103 | if( pex.IsAnyFrontButton() ) |
martwerl | 0:dcd423180481 | 104 | { |
martwerl | 0:dcd423180481 | 105 | break; |
martwerl | 0:dcd423180481 | 106 | } |
martwerl | 0:dcd423180481 | 107 | |
martwerl | 0:dcd423180481 | 108 | } |
martwerl | 0:dcd423180481 | 109 | mL.SetPow(0); |
martwerl | 0:dcd423180481 | 110 | mR.SetPow(0); |
martwerl | 0:dcd423180481 | 111 | |
martwerl | 0:dcd423180481 | 112 | |
martwerl | 0:dcd423180481 | 113 | } |
martwerl | 0:dcd423180481 | 114 | |
martwerl | 0:dcd423180481 | 115 | |
martwerl | 0:dcd423180481 | 116 | void ForW () |
martwerl | 0:dcd423180481 | 117 | { |
martwerl | 0:dcd423180481 | 118 | |
martwerl | 0:dcd423180481 | 119 | mL.SetPow(0.3); |
martwerl | 0:dcd423180481 | 120 | mR.SetPow(0.3); |
martwerl | 0:dcd423180481 | 121 | |
martwerl | 0:dcd423180481 | 122 | while (1 ) |
martwerl | 0:dcd423180481 | 123 | { |
martwerl | 0:dcd423180481 | 124 | pex.ReadButtons(); |
martwerl | 0:dcd423180481 | 125 | |
martwerl | 0:dcd423180481 | 126 | if( pex.IsAnyBackButton() ) |
martwerl | 0:dcd423180481 | 127 | { |
martwerl | 0:dcd423180481 | 128 | break; |
martwerl | 0:dcd423180481 | 129 | } |
martwerl | 0:dcd423180481 | 130 | |
martwerl | 0:dcd423180481 | 131 | } |
martwerl | 0:dcd423180481 | 132 | mL.SetPow(0); |
martwerl | 0:dcd423180481 | 133 | mR.SetPow(0); |
martwerl | 0:dcd423180481 | 134 | |
martwerl | 0:dcd423180481 | 135 | } |