Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int vegSense = 0;
- int vegResistance, high = 0, low = 1023;
- int vegDetect;
- void setup(){
- Serial.begin(9600);
- }
- void loop()
- {
- vegResistance = analogRead(vegSense);
- Serial.print("Resistance:");
- Serial.print(vegResistance);
- Serial.print("\n");
- if (vegResistance>450 & vegResistance<650){ //هنا قيمة اعلى وأقل نقطة مقاومة للبطاطس
- Serial.print("Potatos \n"); // اذا تحقق هذا الشرط اطبع كلمة بطاطس
- }
- else if(vegResistance>200 & vegResistance<400){ //هنا قيمة اعلى وأقل نقطة مقاومة للجزر
- Serial.print("Carrots"); // اذا تحقق هذا الشرط اطبع كلمة جزر
- }
- else {
- Serial.print("No Vegetables \n"); // اذا لم تكن القيمة ضمن اي نطاق اطبع ليس خضار
- }
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment