Liniensensor_Bendel

Dependencies:   BertlLib mbed

Fork of BertlTemplate2 by michael hollegha

Committer:
Lippi
Date:
Mon Mar 14 17:16:26 2016 +0000
Revision:
3:b6754e794335
Child:
4:c157810a12c5
HL Bertl Lienenesensor

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Lippi 3:b6754e794335 1
Lippi 3:b6754e794335 2 #include "mbed.h"
Lippi 3:b6754e794335 3 #include "Serial_HL.h"
Lippi 3:b6754e794335 4 #include "Bertl14.h"
Lippi 3:b6754e794335 5 #include "BertlObjects.h"
Lippi 3:b6754e794335 6
Lippi 3:b6754e794335 7 // main=2^0 LS ENC 2^2
Lippi 3:b6754e794335 8 BusOut boardPow(p30, P1_6, P1_7);
Lippi 3:b6754e794335 9 Timer t1, t2;
Lippi 3:b6754e794335 10 AnalogInHL ls1(p18), ls2(p16), ls3(p20), ls4(p19), ls5(p17);
Lippi 3:b6754e794335 11
Lippi 3:b6754e794335 12
Lippi 3:b6754e794335 13 int main(void)
Lippi 3:b6754e794335 14 {
Lippi 3:b6754e794335 15 boardPow=3;
Lippi 3:b6754e794335 16 wait_ms(10);
Lippi 3:b6754e794335 17 InitBertl();
Lippi 3:b6754e794335 18 pex.useISR=0;
Lippi 3:b6754e794335 19 leds=9;
Lippi 3:b6754e794335 20 pex.ClearLeds();
Lippi 3:b6754e794335 21 t1.start();
Lippi 3:b6754e794335 22 t2.start();
Lippi 3:b6754e794335 23
Lippi 3:b6754e794335 24 while(1) {
Lippi 3:b6754e794335 25 pex.ReadButtons();
Lippi 3:b6754e794335 26 if(pex.IsButton(BTN_FM))
Lippi 3:b6754e794335 27 {
Lippi 3:b6754e794335 28 if (ls3.Read()>400)
Lippi 3:b6754e794335 29 {
Lippi 3:b6754e794335 30 mL.SetPow(0.1);
Lippi 3:b6754e794335 31 mR.SetPow(0.3);
Lippi 3:b6754e794335 32 }
Lippi 3:b6754e794335 33 else
Lippi 3:b6754e794335 34 {
Lippi 3:b6754e794335 35 mL.SetPow(0.3);
Lippi 3:b6754e794335 36 mR.SetPow(0.1);
Lippi 3:b6754e794335 37 }
Lippi 3:b6754e794335 38 }
Lippi 3:b6754e794335 39
Lippi 3:b6754e794335 40 }
Lippi 3:b6754e794335 41
Lippi 3:b6754e794335 42 return 1;
Lippi 3:b6754e794335 43 }