I'm very new to Arduino and had to have lots of help writing this program and getting everything connected correctly but am now stuck. I have a DHT22 sensor (as well as some other connected devices including a bluetooth adapter, eTape, and a few motors) connected to the Arduino and am getting odd values from the sensor for both humidity and temperature. The temperature seems about 20 degrees higher than what it actually is and the humidity is reading over 100% (usually 120%+). At first I thought this might be a faulty sensor. I tried installing the sample code from the DHT22 library and got accurate readings. So I'm now thinking that it's something wrong with my code since that's the only thing that changed. I've posted both the code for my project as well as the sample code from the sensor. Any help would be so appreciated!
I have a DHT22 sensor (as well as some other connected devices including a bluetooth adapter, eTape, and a few motors) connected to the Arduino and am getting odd values from the sensor for both humidity and temperature.
Unplug everything except the DHT22 sensor, and dump all the code related to the not-connected hardware. Do you get valid data?
Connect JUST the bluetooth adapter. Add NO software. Do you still get valid data?
Add JUST the software needed to communicate with the bluetooth adapter. Do you still get valid data?
Debugging is NOT that difficult. But, you have to make sure, when adding ANY new hardware to NOT add software, until you KNOW that adding the hardware doesn't break any existing software. Then, add software for the new hardware, and test each step of the way.
You have WAY too much hardware connected, and WAY too much software, when having the problem you are having.
It's like trying to build a car after ordering all the parts. You open the boxes, and find a tire and a wheel. You mount the tire on wheel, and that worked. So, you assemble ALL the rest of the parts, and the left speaker in the trunk doesn't work. You have a lot of work to do to figure out why not. Far better to test the engine when you get it assembled, then test again after it is mounted in the car, then again after connecting the transmission, and again after connecting the driveshaft.
Thanks so much for the reply PaulS. I had done this when the program etc was being built with the help of the electrical engineer that actually came up with the electronics and code. Everything seemed to work at that point in time. Because of the nature of the project, I had a PCB printed and all the connections hardwired essentially which leaves diagnostics and isolating issues quite challenging. I'll do my best to isolate the problem down to the smallest possible connection/code.