Sensor-Crash

From Microduino Wiki
Revision as of 06:22, 18 September 2017 by Fengfeng (talk | contribs)
Jump to: navigation, search
Microduino Crash-rect-v1.jpg






Sensor-Crash

Product serial number:MSDS11
Add-to-cart.jpg

Sensor-Crash can detect collision, and it can be used as a button switch or a limit switch.



Technical Specifications

  • Voltage:
    • 3.3V~5V working voltage
  • Technical parameter
    • The sensor signal is HIGH before the sensor is pressed, and it changes into LOW after the sensor is pressed.
    • Usually, a mechanical switch has mechanical dither, so when using it, you’d better use program to prevent that.
  • Connection
    • This sensor can be connect to the following ports of Core: D2~D13,A0~A7




Pins

  • IN(Digital signal)
    • PIN1: GND
    • PIN2: VCC
    • PIN3: Digital signal input
    • PIN4: NC(empty)
Sensor backpin.png




Programming Manual

You can learn about Arduino IDE programming to control modules, referring to Getting Started.

Common usage

The signal of Crash can be read directly with digitalRead(): high (1, true) or low (0, false).

#define PIN_KEY 4   //The key is connected to pin 4.  

void setup() {
  Serial.begin(9600);  //Set the baud rate of serial communication. 
  pinMode(PIN_KEY, INPUT);//Set the input state of the key.
}

void loop() {
  if (digitalRead(PIN_KEY))  //Detect the state of the key 
  {
    Serial.println("KEY RELEASED");//Print “KEY RELEASED” from the serial port
  }
  else
  {
    Serial.println("KEY PRESSED");// Print “KEY PRESSED” from the serial port. 
  }
}

Advanced Usage

[_07_m_Sensor_Key] libraries reference page provides the completed details and samples of how to use Crash sensor.


Sensor Key-idecode.JPG




Documentation




Relative Tutorials




Q&A

  • Why does it seem that the results of being pressed and being released are reverse?
    • Because the signal is HIGH before Sensor-Crash is pressed, and after it is pressed, the signal changes into LOW.






History





Gallery


Return to Sensor Page