![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
oki
Fork of ProjetInfo2_Multi by
coffre.cpp
- Committer:
- jujuonthebeat
- Date:
- 2018-05-18
- Revision:
- 0:5755bf39c144
- Child:
- 2:ae058dfdebac
File content as of revision 0:5755bf39c144:
#include"mbed.h" PwmOut servo (p21); BusIn digicode(p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16); void fermer() { servo.pulsewidth(0.194); } void ouvrir() { servo.pulsewidth(0.178); } int lireval(){ int val; if(digicode.read()==0){ val=-3; } if(digicode.read()==2){ val=7; } if(digicode.read()==4){ val=4; } if(digicode.read()==8){ val=1; } if(digicode.read()==16){ val=0; } if(digicode.read()==32){ val=8; } if(digicode.read()==64){ val=5; } if(digicode.read()==128){ val=2; } if(digicode.read()==256){ val=-2; } if(digicode.read()==512){ val=9; } if(digicode.read()==1024){ val=6; } if(digicode.read()==2048){ val=3; } return val; }