Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. void setup() {
  2. Serial.begin(115200);
  3. }
  4.  
  5. // 0=> 0
  6. // 47=> 100
  7. // 94=> 200
  8. // 141=> 300 (still following 47 * n)
  9. // 192=> 400 (1 mark off)
  10. // 246=> 500 (2 mark off)
  11.  
  12. static int MIN_METER = 0;
  13. static int MAX_METER = 246;
  14.  
  15. void loop() {
  16. int value = Serial.parseInt();
  17. if(value != 0) {
  18. value = value;
  19. Serial.println(value);
  20. analogWrite(5, value);
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement