Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <Arduino.h>
  2.  
  3. #define movPin 2
  4. #define Sound 8
  5.  
  6. void setup() {
  7. Serial.begin(9600);
  8. pinMode(movPin, INPUT);
  9. pinMode(Sound, OUTPUT);
  10. }
  11.  
  12. void SIGNALIZACIA(){
  13. int val = digitalRead(movPin);
  14. //Serial.println(val);
  15. if (val){
  16. tone(Sound, 100, 20);
  17. }
  18. tone(Sound, 0, 20);
  19. }
  20.  
  21. void loop(){
  22. SIGNALIZACIA();
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement