Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

Maintenance is complete! We got more disk space.
Become a Patron!

/sci/ - Science & Math

Search:


View post   

[ Toggle deleted replies ]
>> No.11309710 [View]
File: 2.74 MB, 3264x2448, Arduino.jpg [View same] [iqdb] [saucenao] [google] [report]
11309710

Dear C/C++ Chads,

I need your help with a little problem I'm having in my research project because I'm retarded and know little about how to talk to computers.

Hey guys, I'm making a temperature-regulated water tank. There's a heater and a temperature probe, and long story short, the code is written so that if the temperature gets over 37 degrees, the heater turns off, but remains on otherwise to regulate it.

Here's my problem:

The temperature probe will sometimes report a temperature of -127 C. I'm not sure what error this stands for but we believe it's linked to power fluctuations or just errors made in communication along the way. We do not want to display this error at all.

My idea is to code the Arduino to go as follows:

>Request temperature
>If temperature = -127, Request temperature again.
>If temperature > 37, turn heater off
>Else, turn heater on

Running the code like this, it still displayed the occasional error. I'm wanting to communicate that if the temperature is -127, it does NOT report that and does not continue until it gets a non-"-127" temperature. Do not pass GO sort of deal.

What could I implement in the code to bar the code from proceeding until it gets an appropriate temperature?



Navigation
View posts [+24] [+48] [+96]