Commit c79d0ee2 authored by ayodyabanuka's avatar ayodyabanuka

updated Arduino code

parent da66105c
...@@ -95,6 +95,17 @@ void loop() { ...@@ -95,6 +95,17 @@ void loop() {
} }
else if (e == 2) { else if (e == 2) {
digitalWrite(LED1, LOW); digitalWrite(LED1, LOW);
Firebase.getInt(firebaseDataServo, "/Food/" + productnumber + "/SERVO");
s = firebaseDataServo.intData();
Serial.print(" Servo: "); Serial.println(s);
if (s == 0) {
servo.write(0); // tell servo to go to position in variable 'pos'
}
else {
servo.write(180);
}
} }
foodMoistureValue = analogRead(A0); foodMoistureValue = analogRead(A0);
...@@ -112,19 +123,12 @@ void loop() { ...@@ -112,19 +123,12 @@ void loop() {
Firebase.setInt(firebaseDataMoist, "/Food/" + productnumber + "/ERROR", 2); Firebase.setInt(firebaseDataMoist, "/Food/" + productnumber + "/ERROR", 2);
} else { } else {
Firebase.setInt(firebaseDataMoist, "/Food/" + productnumber + "/ERROR", 1); Firebase.setInt(firebaseDataMoist, "/Food/" + productnumber + "/ERROR", 1);
} }
Firebase.setFloat(firebaseDataMoist, "/Food/" + productnumber + "/Moist/foodMoist", foodpercent); Firebase.setFloat(firebaseDataMoist, "/Food/" + productnumber + "/Moist/foodMoist", foodpercent);
Firebase.getInt(firebaseDataServo, "/Food/" + productnumber + "/SERVO");
s = firebaseDataServo.intData();
Serial.print(" Servo: "); Serial.println(s);
if (s == 0) {
servo.write(0); // tell servo to go to position in variable 'pos'
}
else {
servo.write(180);
}
delay(1000); delay(1000);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment