Devices & Components
Arduino Uno Rev3
Jumper wires (generic)
Standard LCD - 16x2 White on Blue
Breadboard (generic)
Resistor 10k ohm
Project description
Code
Arduion Food Detect
c_cpp
Copy paste onto Arduino IDE
1const int frootSense = 0; 2int frootResistance, high = 0, low = 1023; 3int frootDetect; 4#include <LiquidCrystal.h> //remove this if u don't have LCD, anyways it wont affect. 5LiquidCrystal lcd(12,11,5,4,3,2); //remove this if u don't have LCD, anyways it wont affect. 6void setup(){ 7Serial.begin(9600); 8lcd.begin(16, 2); //remove this if u don't have LCD, anyways it wont affect. 9lcd.clear(); //remove this if u don't have LCD, anyways it wont affect. 10} 11void loop() 12{ 13lcd.clear(); //remove this if u don't have LCD, anyways it wont affect. 14lcd.setCursor(0,0); //remove this if u don't have LCD, anyways it wont affect. 15lcd.print("Food Detect:"); //remove this if u don't have LCD, anyways it wont affect. 16lcd.setCursor(0,1); //remove this if u don't have LCD, anyways it wont affect. 17frootResistance = analogRead(frootSense); 18Serial.print("Resistance:"); 19Serial.print(frootResistance); 20Serial.print("\ 21"); 22if (frootResistance>400 & frootResistance<700){ 23Serial.print("Cucumber \ 24"); 25lcd.print("Cucumber"); //remove this if u don't have LCD, anyways it wont affect. 26} 27else if(frootResistance>140 & frootResistance<300){ 28Serial.print("Apple"); 29lcd.print("Apple"); //remove this if u don't have LCD, anyways it wont affect. 30} 31else { 32Serial.print("No Food \ 33"); 34lcd.print("No Food"); //remove this if u don't have LCD, anyways it wont affect. 35} 36delay(1000); 37}
Downloadable files
Circuit
Circuit

Circuit
Circuit

Comments
Only logged in users can leave comments