Guest User

Untitled

a guest
Jan 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. int sensorPin = A0;
  2. int ledPin = 13;
  3. int sensorValue = 0;
  4. int i = 0;
  5. int samples[5];
  6.  
  7.  
  8. void setup() {
  9.  
  10. Serial.begin(9600);
  11. }
  12.  
  13. void loop() {
  14. for(i = 0;i<= 4;i++){
  15. samples[i] = analogRead(sensorPin);
  16. sensorValue = sensorValue + samples[i];
  17. delay(30);
  18. }
  19.  
  20. sensorValue = sensorValue / 5;
  21.  
  22. Serial.println(sensorValue);
  23. for(i = 0;i<= 4;i++){
  24. Serial.print(samples[i]);
  25. Serial.print(" ");
  26. }
  27. Serial.println("");
  28. delay(500);
  29.  
  30. }
Add Comment
Please, Sign In to add comment