run this here
Dependencies: Hexi_KW40Z Hexi_OLED_SSD1351
Diff: main.cpp
- Revision:
- 1:b965810f9bb3
- Parent:
- 0:2b94f7017e4e
- Child:
- 2:75253a344332
diff -r 2b94f7017e4e -r b965810f9bb3 main.cpp --- a/main.cpp Fri Apr 27 05:53:47 2018 +0000 +++ b/main.cpp Fri Apr 27 06:03:28 2018 +0000 @@ -139,12 +139,16 @@ { currentPeriod = ((float)T_temp) / 1000000.0f; currentDutyCycle = D_temp; + // set to low pulse.write(0); + // reset the low to high ticker lowToHigh.detach(); lowToHigh.attach(&tickerHandle, currentPeriod); + highToLow.detach(); + // wait period * duty cycle wait(currentPeriod * currentDutyCycle); // reset the high to low ticker @@ -171,11 +175,11 @@ // start low pulse.write(0); - // ticker that goes from low to high every period seconds + // 1) ticker that goes from low to high every period seconds lowToHigh.attach(&tickerHandle, currentPeriod); - // wait period * duty cycle + // 2) wait period * duty cycle wait(currentPeriod * currentDutyCycle); - // ticker that goes from high to low every period seconds + // 3) ticker that goes from high to low every period seconds highToLow.attach(&tickerHandle, currentPeriod); t1.start(callback(&q1, &EventQueue::dispatch_forever));