The parts we need
---------------------------
-Arduino
-Jumper Wires
-FOOD❤❤❤❤(I used cucumber and red plum)
-LCD
-10k ohm Potentiometer
-10k ohm Resistance
---------------------------
And here is a diagram of our circuit
The probes are just simple wires or you can use little metal rods. |
---------------------------
#include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2); const int sensorVal = A0; void setup() { // put your setup code here, to run once: lcd.begin(16, 2); lcd.print("Food Detect:"); Serial.begin(9600); } void loop() { int sensor = analogRead(sensorVal); delay(200); lcd.setCursor(0, 1); if (sensor<10) { lcd.print("No Food"); lcd.print(" "); } else if(sensor<400 & sensor>280) { lcd.print("Cucumber"); lcd.print(" "); } else if(sensor<279 & sensor>100) { lcd.print("Red Plum"); lcd.print(" "); } Serial.println(sensor); }
---------------------------Some pictures about my circuitYes it's that simple guys.Ask me anything in the comment section.^-^ See you later inanother tutorial ^-^
No comments:
Post a Comment