hige dura
/
PWM_generator
PWM_generator
Revision 1:1d1a7680a3fe, committed 2012-12-05
- Comitter:
- higedura
- Date:
- Wed Dec 05 05:53:03 2012 +0000
- Parent:
- 0:566768f53e4b
- Commit message:
- PWM_generator
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 566768f53e4b -r 1d1a7680a3fe main.cpp --- a/main.cpp Wed Dec 05 05:27:10 2012 +0000 +++ b/main.cpp Wed Dec 05 05:53:03 2012 +0000 @@ -5,19 +5,33 @@ int main() { - int pulse_buf = 0; - double pulse = 0; - + int key_in = 0; + double pulse_buf2 = 0; + double pulse = 0; + esc.period(0.018); esc.pulsewidth(0.001); while (1) { - pulse_buf = pc.getc()-48; - pulse = 0.001+0.0001*(double)pulse_buf; + // ASCII henkan omazinai + key_in = pc.getc()-48; + //pc.printf("%d",key_in); + + //if(){ + //pulse_buf ni value wo input + //} + + // pulse no tasizan 0.001 ~ 0.002 + //pulse = 0.001+0.0001*(double)pulse_buf; + + // limmiter if( pulse<0.001 ){ pulse = 0.001; } if( 0.0019<pulse ){ pulse = 0.0019; } + + // updating pulse width esc.pulsewidth(pulse); + pc.printf("%f\r\n", pulse); }