Guest User

Untitled

a guest
Dec 13th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. period = 256;
  2. on_time = 34; // Or whatever you want
  3. off_time = period-on_time;
  4. count = 0;
  5. while (1);
  6. {
  7. if (count >= 0) {
  8. count -= off_time;
  9. output_high();
  10. } else {
  11. count += on_time;
  12. output_low();
  13. }
  14. wait_for_next_cycle();
  15. }
Add Comment
Please, Sign In to add comment