Guest User

Untitled

a guest
Sep 5th, 2017
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. /*
  2. Sketch uses 1,708 bytes (20%) of program storage space. Maximum is 8,192 bytes.
  3. Global variables use 68 bytes (13%) of dynamic memory, leaving 444 bytes for local variables. Maximum is 512 bytes.
  4. */
  5. #include "PWM/PWM.h"
  6. int val(0);
  7.  
  8.  
  9. void setup()
  10. {
  11. pinMode(0, OUTPUT);
  12. pinMode(1, OUTPUT);
  13. pwm.set(1,'a',32000,5,false);
  14. pwm.set(1,'a',32000,5,true);
  15. pwm.start();
  16. }
  17.  
  18. void loop()
  19. {
  20.  
  21. val = analogRead(3)/10;
  22. val = map(val, 0, 100, 0, 100);
  23. if(val <= 100)
  24. {
  25. // The duty cycle on this is broken and so are the pins for 0 & 1
  26. pwm.set(0,'a',32000,val,false);
  27. pwm.set(1,'a',32000,val,true);
  28. }
  29. }
Add Comment
Please, Sign In to add comment