thomas strcic
/
ProjetInfo2_Multi12
oki
Fork of ProjetInfo2_Multi by
coffre.cpp@0:5755bf39c144, 2018-05-18 (annotated)
- Committer:
- jujuonthebeat
- Date:
- Fri May 18 14:04:05 2018 +0000
- Revision:
- 0:5755bf39c144
- Child:
- 2:ae058dfdebac
nana
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jujuonthebeat | 0:5755bf39c144 | 1 | #include"mbed.h" |
jujuonthebeat | 0:5755bf39c144 | 2 | |
jujuonthebeat | 0:5755bf39c144 | 3 | |
jujuonthebeat | 0:5755bf39c144 | 4 | |
jujuonthebeat | 0:5755bf39c144 | 5 | PwmOut servo (p21); |
jujuonthebeat | 0:5755bf39c144 | 6 | BusIn digicode(p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16); |
jujuonthebeat | 0:5755bf39c144 | 7 | |
jujuonthebeat | 0:5755bf39c144 | 8 | |
jujuonthebeat | 0:5755bf39c144 | 9 | void fermer() |
jujuonthebeat | 0:5755bf39c144 | 10 | { |
jujuonthebeat | 0:5755bf39c144 | 11 | servo.pulsewidth(0.194); |
jujuonthebeat | 0:5755bf39c144 | 12 | } |
jujuonthebeat | 0:5755bf39c144 | 13 | |
jujuonthebeat | 0:5755bf39c144 | 14 | void ouvrir() |
jujuonthebeat | 0:5755bf39c144 | 15 | { |
jujuonthebeat | 0:5755bf39c144 | 16 | |
jujuonthebeat | 0:5755bf39c144 | 17 | servo.pulsewidth(0.178); |
jujuonthebeat | 0:5755bf39c144 | 18 | } |
jujuonthebeat | 0:5755bf39c144 | 19 | |
jujuonthebeat | 0:5755bf39c144 | 20 | int lireval(){ |
jujuonthebeat | 0:5755bf39c144 | 21 | int val; |
jujuonthebeat | 0:5755bf39c144 | 22 | if(digicode.read()==0){ |
jujuonthebeat | 0:5755bf39c144 | 23 | val=-3; |
jujuonthebeat | 0:5755bf39c144 | 24 | } |
jujuonthebeat | 0:5755bf39c144 | 25 | if(digicode.read()==2){ |
jujuonthebeat | 0:5755bf39c144 | 26 | val=7; |
jujuonthebeat | 0:5755bf39c144 | 27 | } |
jujuonthebeat | 0:5755bf39c144 | 28 | if(digicode.read()==4){ |
jujuonthebeat | 0:5755bf39c144 | 29 | val=4; |
jujuonthebeat | 0:5755bf39c144 | 30 | } |
jujuonthebeat | 0:5755bf39c144 | 31 | if(digicode.read()==8){ |
jujuonthebeat | 0:5755bf39c144 | 32 | val=1; |
jujuonthebeat | 0:5755bf39c144 | 33 | } |
jujuonthebeat | 0:5755bf39c144 | 34 | if(digicode.read()==16){ |
jujuonthebeat | 0:5755bf39c144 | 35 | val=0; |
jujuonthebeat | 0:5755bf39c144 | 36 | } |
jujuonthebeat | 0:5755bf39c144 | 37 | if(digicode.read()==32){ |
jujuonthebeat | 0:5755bf39c144 | 38 | val=8; |
jujuonthebeat | 0:5755bf39c144 | 39 | } |
jujuonthebeat | 0:5755bf39c144 | 40 | if(digicode.read()==64){ |
jujuonthebeat | 0:5755bf39c144 | 41 | val=5; |
jujuonthebeat | 0:5755bf39c144 | 42 | } |
jujuonthebeat | 0:5755bf39c144 | 43 | if(digicode.read()==128){ |
jujuonthebeat | 0:5755bf39c144 | 44 | val=2; |
jujuonthebeat | 0:5755bf39c144 | 45 | } |
jujuonthebeat | 0:5755bf39c144 | 46 | if(digicode.read()==256){ |
jujuonthebeat | 0:5755bf39c144 | 47 | val=-2; |
jujuonthebeat | 0:5755bf39c144 | 48 | } |
jujuonthebeat | 0:5755bf39c144 | 49 | if(digicode.read()==512){ |
jujuonthebeat | 0:5755bf39c144 | 50 | val=9; |
jujuonthebeat | 0:5755bf39c144 | 51 | } |
jujuonthebeat | 0:5755bf39c144 | 52 | if(digicode.read()==1024){ |
jujuonthebeat | 0:5755bf39c144 | 53 | val=6; |
jujuonthebeat | 0:5755bf39c144 | 54 | } |
jujuonthebeat | 0:5755bf39c144 | 55 | if(digicode.read()==2048){ |
jujuonthebeat | 0:5755bf39c144 | 56 | val=3; |
jujuonthebeat | 0:5755bf39c144 | 57 | } |
jujuonthebeat | 0:5755bf39c144 | 58 | return val; |
jujuonthebeat | 0:5755bf39c144 | 59 | } |