»óÇ°Ä«Å×°í¸® > ¼¾¼­ > ±â¿ï±â/Æ¿Æ®

±â¿ï±â ¼¾¼­, Æ¿Æ® (Tilt Sensor - AT407)
ÆǸŰ¡°Ý : 9,200¿ø (ºÎ°¡¼¼ Æ÷ÇÔ)
»óÇ°ÄÚµå : [3356]ZAS-PTW-SP-10289
¹è¼ÛÀÏ : ´çÀϹ߼Û
Á¦Á¶»ç : Sparkfun
ºê·£µå : SparkFun [ºê·£µå¸ô ¹Ù·Î°¡±â]
³²Àº¼ö·® : 5°³
±¸¸Å¼ö·® :
°³
ÃÑ ±Ý¾× :
Ãß°¡&´ë·®±¸¸Å ¿äû 053-588-4080

  • »óÇ°»ó¼¼
  • °ü·Ã»óÇ°
  • ¹è¼Û/±³È¯/¹ÝÇ° ¾È³»
  • »óÇ°¸®ºä

AT407 ±â¿ï±â ¼¾¼­ÀÔ´Ï´Ù. ¾ÈÂÊÀÇ °øÀÌ ¼¾¼­ÀÇ ¿¬°áÀ» °áÁ¤Çϸç ÀÌ·Î½á ´Ü¶ôÀÌ °áÁ¤µË´Ï´Ù.

ÀÏ¹Ý ½ºÀ§Ä¡ »ç¿ë ¹æ¹ý°ú ºñ½ÁÇÕ´Ï´Ù.


°ü·Ã ¹®¼­ 


»ç¿ë ¿¹Á¦

±â¿ï±â ¼¾¼­·Î ´ÙÀ½°ú °°ÀÌ È¸·Î¸¦ ±¸¼ºÇؼ­ ±â¿ï±â¸¦ °¨ÁöÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀúÇ×Àº 10K ÀúÇ×À» Ç®¾÷À¸·Î »ç¿ëÇÏ¿´½À´Ï´Ù.


¾ÆµÎÀÌ³ë ¼Ò½ºÄÚµå

  1. int inPin = 2; // the number of the input pin
  2. int outPin = 13; // the number of the output pin
  3. int LEDstate = HIGH; // the current state of the output pin
  4. int reading; // the current reading from the input pin
  5. int previous = LOW; // the previous reading from the input pin
  6. // the follow variables are long's because the time, measured in miliseconds,
  7. // will quickly become a bigger number than can be stored in an int.
  8. long time = 0; // the last time the output pin was toggled
  9. long debounce = 50; // the debounce time, increase if the output flickers
  10. void setup()
  11. {
  12. pinMode(inPin, INPUT);
  13. digitalWrite(inPin, HIGH); // turn on the built in pull-up resistor
  14. pinMode(outPin, OUTPUT);
  15. }
  16. void loop()
  17. {
  18. int switchstate;
  19. reading = digitalRead(inPin);
  20. // If the switch changed, due to bounce or pressing...
  21. if (reading != previous) {
  22. // reset the debouncing timer
  23. time = millis();
  24. }
  25. if ((millis() - time) > debounce) {
  26. // whatever the switch is at, its been there for a long time
  27. // so lets settle on it!
  28. switchstate = reading;
  29. // Now invert the output on the pin13 LED
  30. if (switchstate == HIGH)
  31. LEDstate = LOW;
  32. else
  33. LEDstate = HIGH;
  34. }
  35. digitalWrite(outPin, LEDstate);
  36. // Save the last reading so we keep a running tally
  37. previous = reading;
  38. }

Description: This AT407 basic tilt switch can easily be used to detect orientation. Inside the can are a pair of balls that make contact with the pins when the case is upright. Tilt the case over and the balls don¡¯t touch, thus not making a connection.

There are numerous uses for these basic sensors, but keep in mind you might need to use some debouncing code, as the sensor isn¡¯t immune to small vibrations and such.

Documents:

¸ÞÄ«¸®¿öÁî






°ßÀû¿äû
±¸¸Å´ëÇà
Äü/¹æ¹®¼ö·É
ÈĺҰáÁ¦
±â¼ú¹®ÀÇ