Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "PwmIn.h" 00003 00004 00005 Timer t; 00006 PwmOut white_up(PC_8),white_down(PC_9),gray_up(PC_6),gray_down(PB_8); 00007 PwmIn lin(A0),rin(A1); 00008 int main() 00009 { 00010 white_up.period_ms(2.5); 00011 white_down.period_ms(2.5); 00012 gray_up.period_ms(2.5); 00013 gray_down.period_ms(2.5); 00014 while(1){ 00015 if(lin.dutycycle()<0.59 ){ 00016 gray_down.write(-(lin.dutycycle()-0.59)*4.34); 00017 wait_ms(10); 00018 } 00019 else if(lin.dutycycle()>0.61){ 00020 white_down.write((lin.dutycycle()-0.61)*4.54 ); 00021 wait_ms(10); 00022 } 00023 else{ 00024 white_down.write(0); 00025 gray_down.write(0); 00026 wait_ms(10); 00027 } 00028 if(rin.dutycycle()< 0.59){ 00029 gray_up.write(-(rin.dutycycle()-0.59)*4.34 ); 00030 wait_ms(10); 00031 } 00032 else if(rin.dutycycle()>0.61){ 00033 white_up.write((rin.dutycycle()-0.61)*4.34 ); 00034 wait_ms(10); 00035 } 00036 else{ 00037 white_up.write(0); 00038 gray_up.write(0); 00039 wait_ms(10); 00040 } 00041 } 00042 00043 00044 00045 00046 }
Generated on Mon Aug 1 2022 01:14:31 by
1.7.2