Timeline for Arduino due temperature reading shows random temperatures
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 12, 2017 at 15:06 | review | Suggested edits | |||
| Dec 12, 2017 at 16:15 | |||||
| Nov 12, 2017 at 16:36 | comment | added | Mitu Raj | yea if this worked, you can write the same function for the next two sensors too...And just call this function one by one from the main code | |
| Nov 12, 2017 at 16:30 | comment | added | Meysam Afghani | float GetTemp(int pinN){ for(int i =0; i < 31600; i++){ highDuration = highDuration + digitalRead(pinN); delayMicroseconds(50); } hcf = highDuration; dutyCycle = highDuration / (float) 31600; temp = (dutyCycle - 0.32)/0.0047; highDuration = 0; return temp; } | |
| Nov 12, 2017 at 16:30 | comment | added | Meysam Afghani | I ran the code for 1 sensor without any adding additional code and the temp seemed to be stable and pretty accurate with a sampleSize of 31600 so I wrote this function with 31600 sample rate with 10 microsecond intervals and it does work can I just go with this ? | |
| Nov 12, 2017 at 14:38 | comment | added | Mitu Raj | You have to code some logic using if conditions and a variable to keep track of time passed. Based on the value of that variable , call functions for processing sensor 1, 2 or 3. | |
| Nov 12, 2017 at 14:34 | comment | added | Meysam Afghani | I don't understand how to divide it into different time frames. Is it possible to create a function for getting temperature and call it three times for each sensor ? if so how do I write the function where is the exit point of it ? | |
| Nov 12, 2017 at 14:20 | comment | added | Mitu Raj | One solution is to shift the start of sampling of three sensors. Divide the time frame into 3 parts. First time frame only for sampling and displaying the temp of sensor 1, second one only for second sensor, first sensor would be idle. Like that. But the temperature update interval will increase. | |
| Nov 12, 2017 at 14:14 | comment | added | Mitu Raj | I don't think so. This is already running in loop under void loop(). So It may still have the same problem. | |
| Nov 12, 2017 at 14:11 | comment | added | Meysam Afghani | So if I put it in a for loop to guarantee the needed sample it should work right ? is there better way to do this ? thank you for responding | |
| Nov 11, 2017 at 21:03 | history | answered | Mitu Raj | CC BY-SA 3.0 |