Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. void countercode() {
  2.  
  3. sensorout = analogRead(sensor);
  4.  
  5.  
  6. //Serial.println(sensorout);
  7. if (sensorout < 5) {
  8. trigger = 1;
  9. }
  10.  
  11. if (sensorout > 1000) {
  12. trigger = 0;
  13. }
  14.  
  15.  
  16.  
  17. if (trigger != laststate) {
  18. if (trigger == HIGH) {
  19. //Serial.println(counter);
  20.  
  21. //omd bliver sendt til computerapp
  22.  
  23. counter++;
  24. counter2++;
  25. lastcount = counter;
  26. //delay(200);
  27.  
  28. if (counter2 <= 4) {
  29. Serial.println(counter2);
  30.  
  31. }
  32.  
  33. if (counter2 > 4) {
  34. omd++;
  35. counter2 = 0;
  36. }//slut computerapp...
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43. }
  44. }
  45.  
  46. laststate = trigger;
  47.  
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement