Search

CN-121978662-A - Distance meter system capable of controlling alarm distance

CN121978662ACN 121978662 ACN121978662 ACN 121978662ACN-121978662-A

Abstract

The invention discloses a range finder system capable of controlling alarm distance, which comprises the following steps of importing a third party library, creating variables, creating classes, using a function setup (), using a function loop (), wherein the third party library is mind libraries, the created variables are float types, initializing an OLED display screen for OLED screen cleaning, and the function loop () is repeatedly executed according to the sequence, wherein the logic of the function loop () is that the length value is set as the value of reading ultrasonic distance and analog pin, one row of OLED displays the connection length value and the reminding value, if the length value is smaller than or equal to the reminding value, three rows of OLED display the reminding value correctly, the digital pin 2 is set as high level, the digital pin 3 is set as low level, and the PWM pin 6 is set as 0.

Inventors

  • Zhai Xuanrui

Assignees

  • 翟轩锐

Dates

Publication Date
20260505
Application Date
20240115

Claims (7)

  1. 1. The range finder system capable of controlling the alarm distance is characterized by comprising the steps of importing a third party library, then creating variables, creating classes, using a function setup (), and using a function loop ().
  2. 2. The range finder system for controlling alarm distance according to claim 1, wherein the third party library is mind library.
  3. 3. The distance meter system for controlling alarm distance according to claim 1, wherein said creation variable type is a float type.
  4. 4. The distance meter system for controlling alarm distance according to claim 1, wherein the function setup () initializes the OLED display screen to perform OLED screen cleaning.
  5. 5. The range finder system with controllable alarm distance according to claim 1, wherein the function loop () is repeatedly performed in sequence.
  6. 6. The distance meter system according to claim 5, wherein the logic of the function loop () is to set the length value to the value of the read ultrasonic distance and the read analog pin, wherein one row of the OLED displays the connection length value and the alert value, wherein if the length value is equal to or less than the alert value, three rows of the OLED display the alert value correctly, wherein the three rows of the OLED display the digital pin 2 high, wherein the digital pin 3 low, wherein the PWM pin 60, wherein if the length value is greater than the alert value, the three rows of the OLED display the alert value incorrectly, wherein the digital pin 2 low, wherein the digital pin 3 high, and wherein the PWM pin 6 255.
  7. 7. The range finder system for controlling an alarm distance according to claim 1, wherein the system is adapted for each motherboard.

Description

Distance meter system capable of controlling alarm distance Technical Field The invention relates to the field of range finders, in particular to a range finder system capable of controlling alarm distance. Background In the technical field of sensors, along with the continuous development of technology, sensors are increasingly widely applied in various fields. Ranging sensors are also increasingly used as one of the sensors. There are many types of ranging sensors on the market at present, such as laser ranging sensors, infrared ranging sensors, ultrasonic ranging sensors, etc. The sensors can rapidly and accurately measure the distance of a target object through different working principles. In the technical field of distance measurement, the distance measurement technology is an important application technology in modern technology, and has wide application prospects in the fields of robot navigation, safety monitoring, automatic control and the like. At present, the distance measurement technology has been developed to a great extent, and various high-precision and high-efficiency distance measurement methods are continuously emerging. In the field of ultrasound technology, ultrasound is a sound wave with a frequency that is higher than the range audible to the human ear. The ultrasonic sensor can accurately measure the distance by utilizing the characteristics of ultrasonic waves, and is not influenced by factors such as light rays, colors and the like. Accordingly, ultrasonic sensors have found wide application in many fields. In the field of hardware programming, with the development of the internet of things and embedded systems, various novel hardware devices are continuously emerging. The developer needs to be skilled in mastering various hardware platforms and programming languages, such as Arduino, rareberry Pi, etc., to realize efficient hardware configuration and software development. In the technical field of the Internet of things, the Internet of things is used for connecting a physical world with a virtual world through a network technology, so that intelligent control and management are realized. The development of the internet of things provides more possibilities for a ranging system, and the ranging system can realize remote data transmission and control through a wireless network technology. However, there are few rangefinder systems on the market that can control the alarm distance, or there are some drawbacks of the related technologies, such as low flexibility, low efficiency, complexity, and single function. Disclosure of Invention The invention aims to overcome the technical defects, provide a range finder system capable of controlling the alarm distance, and solve the problems of low flexibility, low efficiency, complexity and single function. In order to solve the technical problems, the distance meter system capable of controlling the alarm distance comprises the following steps of importing a third party library, then creating variables, creating classes, using a function setup (), and using a function loop (). Further, the third party library is mind library. Further, the creation variable type is a float type. Further, the function setup () initializes the OLED display screen to perform OLED screen cleaning. Further, the function loop () is to be repeatedly executed in order. Further, the logic of the function loop () is that the length value is set as the value of the read ultrasonic distance and the read analog pin, one row of the OLED displays the connection length value and the reminding value, if the length value is smaller than or equal to the reminding value, three rows of the OLED display the correct reminding value, the digital pin 2 is set as high level, the digital pin 3 is set as low level, the PWM pin 6 is set as 0, if the length value is larger than the reminding value, three rows of the OLED display the wrong reminding value, the digital pin 2 is set as low level, the digital pin 3 is set as high level, and the PWM pin 6 is set as 255. Further, the system is applicable to all mainboards. Compared with the prior art, the system has the advantages of high flexibility, high universality and flexibility, and convenience in integration on different hardware platforms, and is suitable for all mainboards. The method is efficient and concise, and the existing mature technology and resources can be fully utilized by importing the third party library, so that development time and cost are reduced. The system can not only measure the distance by ultrasonic wave, but also obtain more environmental information by reading the value of the analog pin. The system is easy to use, and the system is simple to initialize and comprises operations such as OLED screen cleaning and the like. And the logic of the function loop () is clear, so that the development and the debugging are convenient. And the alarm function is that when the measured length value is smaller than or equal