c++ - 我要是拿着一对红外线感应器,和电脑连起来,统计红外线被阻断了几次?都需要什么知识?
PHPz
PHPz 2017-04-17 14:27:12
0
3
721

我要是拿着一对红外线感应器,和电脑连起来,统计红外线被阻断了几次?

红外线就是一个发射器,一个接收器,要是一个人走过的话,那么信号被阻断,应该会传递一个信息..

其实也不用红外线,电灯泡也行呀.

都需要什么编程语言?硬件知识?

其实直接这样问,也不会得到一个很具体的答案,但是大家都能说说自己知道的..
凑凑就懂了道理,不然一点都不懂.

其实我就是不懂,红外线制造了一个信号,电脑怎么接收到的..
比如你发一个变量 给 php 服务器的话,用post get 方式就能收到...

PHPz
PHPz

学习是最好的投资!

reply all(3)
洪涛
  1. What is the connection method between the infrared sensor and the computer, serial port? USB?

  2. What programming language is used to write the receiving program on the computer, C++? C#? (I have only done it on Windows)

  3. I don’t know what you call an infrared sensor. The infrared sensors I have seen are similar to transistors and diodes without any computing power. In this case, you need to connect the infrared sensor to the microcontroller, collect the sensor signal through the microcontroller, and then communicate with the computer through the serial port or USB.

If I did it, I would consider:

  1. Selection of microcontroller

  2. Direct communication protocol between infrared sensor and microcontroller

  3. On the computer side, I usually use C# to write serial communication programs, which is simple and useful

刘奇

Let me explain to you. There are related controllers and signal conversion units inside the sensor. If the infrared signal is blocked and the status changes, the internal register is worth changing. . This involves the design of the lowest level thing, just like the light signals perceived by your eyes are converted into electrical signals and transmitted to your brain. . Leave it alone. The computer can just read this value, connect to the peripheral, allocate an I/O address, and then call the relevant functions for reading and writing IO. . You can use any language, usually C or C++, it would be better if you understand some microcomputer principles

大家讲道理

The infrared receiver will produce level changes as the infrared physical signal changes. For example, it is always high level when there is infrared irradiation, and it is always low level when there is no infrared irradiation. This is a problem at the analog circuit and digital circuit level.

Using a microcontroller, you can connect the pin to the infrared receiver to detect the level change, trigger an external interrupt, and the interrupt service routine is called. You can write the interrupt service routine yourself to handle it, such as forwarding it to other devices. . This is all a matter at the microcontroller level, or it may be a matter of some kind of packaged driver chip.

There are many ways for microcontrollers to forward data. The most common one is to use a serial port to communicate with a computer that supports the serial port (older computers have serial ports).

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template