int val = 0;
int val2 = 0;
int count1 = 1;
int count2 = 1;
int countTotal = 1;
float percent = 0;
int micAnalog = A0;//Declare a variable for the soil moisture sensor
int micDigital = D0;
int micAnalog2 = A2;//Declare a variable for the soil moisture sensor
int micDigital2 = D2;
void setup()
{
Serial.begin(9600);
pinMode(micAnalog, INPUT);
pinMode(micDigital, INPUT);
//digitalWrite();
}
void loop()
{
countTotal = count1+count2;
percent = float(count1)/float(countTotal);
val = analogRead(micAnalog);
if(val > 2900)
{
/*
Serial.print(analogRead(micAnalog));*/
count1++;
Serial.print(count1);
Serial.print("\t");
Serial.print(1-percent);
Serial.print("\t");
Serial.println("mic1");
}
val2 = analogRead(micAnalog2);
if(val2 > 3100)
{
/*
Serial.print(analogRead(micAnalog2));*/
count2++;
Serial.print(count2);
Serial.print("\t");
Serial.print((percent));
Serial.print("\t");
Serial.println("mic2");
}
//Serial.println(val);
}
Click to Expand
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .