tuan din engku syasya syazwani
/
SYASYA
BIPBIP CARRE
Diff: main.cpp
- Revision:
- 0:929b9389852e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jun 06 09:35:06 2017 +0000 @@ -0,0 +1,59 @@ +#include "mbed.h" +#define periode 0.0001 +#define tourne 0.81 +#define dist 2.27 + +DigitalIn fdc(D2); +DigitalIn jack(D3); +PwmOut motg(D6); +PwmOut motd(D8); +DigitalOut Smot1(D7); +DigitalOut Smot2(D9); + +int main() + +{ + int ib,dist=ib; + motg.period(periode); + motd.period(periode); + + if(jack.read()==1) { + + Smot1.write(1); + Smot2.write(1); + + //roule + + motd.pulsewidth(0.00007); + motg.pulsewidth(0.00007); + wait(dist); + motd.pulsewidth(0.00007); + motg.pulsewidth(0.0001); + wait(tourne); + + motd.pulsewidth(0.00007); + motg.pulsewidth(0.00007); + wait(dist); + motd.pulsewidth(0.00007); + motg.pulsewidth(0.0001); + wait(tourne); + + motd.pulsewidth(0.00007); + motg.pulsewidth(0.00007); + wait(dist); + motd.pulsewidth(0.00007); + motg.pulsewidth(0.0001); + wait(tourne); + + motd.pulsewidth(0.00007); + motg.pulsewidth(0.00007); + wait(dist); + motd.pulsewidth(0.00007); + motg.pulsewidth(0.0001); + wait(tourne); + + motd.pulsewidth(0.0001); + motg.pulsewidth(0.0001); + wait(100000); + } +}