The board we got two days ago. The first test is 18b20, but the value cannot be read. At first, I directly connected the analog port. Later I realized that this was not a simulated sensor, but a number. It is switched to a digital port. analog voltage can be used to indicate different temperatures. If it is digital, there must be a mechanism.
Google knows the onewire library and dallastemperature library. Follow the demoProgramStill cannot read the value, always 0.00.
I have also seen the direct use of the 18b20 chip to read the temperature from the Internet, all of which are connected to the pull RESISTANCE OF 4.7k. But I think I bought an integrated chip. I can use it directly.
If I cannot get it out, I will put it down first. The LCD will be finished first, and there will be no welding pin on the board. On the first night, I spent 80% of my time on the welding pin. But fortunately, it was finally successful.
The LCD I bought is cheap, so it is a stockade. Therefore, it has no instructions for use. The seller has a saying that the serial port should be used to "change the resistance on R9 to R10 ". That's right, as he said. However, no matter whether the resistor is placed on R9 or R10, the PSB foot will not be connected. On R9 (parallel), it's okay if PSB is connected to + 5 V. If you want to switch PSB to the serial port mode again, it will be short-circuited. The consequences can be imagined.
The wiring table is as follows:
/* LCD arduinopin1 = gndpin2 = 5vpin4 (CS) = 8; pin5 (SID) = 9; pin6 (sclk) = 10; pin19 = 5vpin20 = Gnd
Note that it corresponds to the definition in the library file */
19 and 20 feet can be directly connected with 2 and 1 feet with a line. But I didn't do this. I just picked up the bread.
Power-on, upload program, display successful. Go to bed.
The next day, I added a 4.8 K temperature sensor (I didn't have a K resistance and used two 2-4 K Series connections) to the pull-up resistance, and then I came out. Happy.
Figure 1: pull-up Resistance
Figure 2: Temperature Sensor
Figure 3: overall figure (the line in the lower left is connected to the LCD)
Figure 4: Current Room Temperature
Figure 5. Cover the sensor with your hands for a while, and the temperature will come up.
Then display it on the LCD. As a result, the temperature is float, and the LCD function uses the unsigned char *, which is a waste of time for anyone who knows nothing about C ++. Depressed and angry.
No one can help in the QQ group. Chilling.
Damn it, you have to rely on yourself.
Fortunately, it was okay when I was about to give up.
Experimental video: http://v.youku.com/v_show/id_XMzQxNjc3MjUy.html
Circuit diagram: