스마트팜

#2-8 eTape Liquid Level Sensor 액체 수위 레벨 센서

ZEROWIN.ART 2022. 3. 23. 15:33
728x90

eTape 액체 수위 레벨 센서

 

   
datasheet https://cdn-shop.adafruit.com/datasheets/eTapeApp.pdf
 

아두이노 연결

   
 

참고 소스++0

............................***********코드

https://www.parallax.com/download/?search=liquid 

소스코드

 



int eTape = 0;

#define MAX_NUM 100
int backupArray[MAX_NUM] = { 0, };


void setup()
{
  Serial.begin(9600); 
}



int index = 0;
int timeout = 0;
void loop()
{
  eTape = analogRead(A0);  //Change Analog pin used here

  backupArray[index] = eTape;
  if(timeout < MAX_NUM) timeout += 1;
  index += 1; if(MAX_NUM < index) index = 0;
  double total = 0;
  for(int i = 0; i < MAX_NUM; i++) {
    total += backupArray[i];
  }
  
  if(MAX_NUM <= timeout) total /= MAX_NUM;
  else total = 0;
  
//  Serial.print("eTape voltage = ");
  Serial.print(eTape, DEC); Serial.print(',');
  Serial.println(total);
  delay(100);
}

그래프


파랑 : 실제값,  빨강 : 평균값  
 

동영상 테스트