hige dura
/
PWM_generator
PWM_generator
Diff: main.cpp
- Revision:
- 1:1d1a7680a3fe
- Parent:
- 0:566768f53e4b
--- 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); }