Advertisement
Guest User

Untitled

a guest
Dec 24th, 2019
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. int soundPin = A0;
  2.  
  3. void setup() {
  4. // put your setup code here, to run once:
  5. Serial.begin(9600);
  6. }
  7.  
  8. void loop() {
  9. // put your main code here, to run repeatedly:
  10. long sum = 0;
  11. for (int i = 0; i < 100; i++)
  12. {
  13. sum += analogRead(soundPin);
  14. }
  15.  
  16. sum = sum/100;
  17.  
  18. Serial.println(sum);
  19.  
  20. delay(10);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement