1. What is a sensor?
A sensor is a physical device or biological organ that can detect and feel external signals, physical conditions (such as light, heat, humidity), or chemical components (such as smoke ), and transmit the information to other devices or organs. The definition of the sensor in the national standard GB7665-87 is: "A device or device that can feel the specified measurement and convert to available signals according to certain rules, usually composed of sensitive components and conversion components ". A sensor is a detection device that can sense the information to be measured and convert the information to an electrical signal or other forms of information output according to certain rules, to meet the requirements of information transmission, processing, storage display, recording and control. It is the first step to achieve automatic detection and automatic control.
Ii. Sensor category
Classified by measured physical quantity, which can be divided
Displacement sensors,
Speed Sensor,
Accelerometer,
Pressure sensors,
Temperature sensors,
Photosensitive sensors,
Acoustic sensors, etc.
There are also many extensions: Iris fingerprints ......
3. Functions of Sensors
Example:
What type of sensors are used for the automatic flushing function in public toilets and how to implement automatic flushing?
What type of sensors are used for the automatic sprinkler function in the building and how to implement automatic sprinkler.
4. Android sensor development
(1) sensing types supported by Android
Gyroscope sensor. type_gyroscope
Acceleration Sensor. type_accelerometer
Optical sensor. type_light
Temperature sensing sensor. type_temperature
Sensor. Orientation
Magnetic field sensing sensor. type_magnetic_field
Proximity sensor. type_proximity
(2) sensormanager class
(3) sensor class
(4) sensorevent class
(5) Development Process
A. Obtain the system service sensor_service and return sensormanager.
B. Obtain the sensor type object instance through sensormanager.
C. Declare a sensoreventlistener object to listen to sensor and reload onsensorchanged
Method.
D. register the corresponding sensorservice.
E. Destroy the corresponding sensorservice.
[Several commonly used induction models]
Sample: gravity acceleration.
Sample: Flip the phone to stop playing the song, and start playing the song on the front. The sensor orientation.
(6) How to Use
16. Sensor)