#include <math.h>
double temp,data;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(A0,INPUT_ANALOG);
}
void loop() {
// put your main code here, to run repeatedly:
temp=(long)analogRead(A0);
data=(exp(0.0056*temp))*0.467;
Serial.print("the depth is:");
Serial.print(data);
Serial.println("cm");
delay(500);
}
歡迎光臨 (http://www.torrancerestoration.com/bbs/) | Powered by Discuz! X3.1 |