6808| 3
|
[求助] 为什么两个传感器会出错 |
两个薄膜压力传感器,捏第一个的时候没反应,捏第二个的时候数值同时变化这是代码,望大佬求组 #include<LiquidCrystal.h> #define LM35 A0 #define LED 10 #define LM A1 LiquidCrystal lcd(12,11,5,4,3,2); int val = 0; int vam = 0; float temp=0; float tem=0; void setup () { pinMode(LED, INPUT); lcd.begin(16,2); lcd.print("welcome tu use!"); delay(1000); lcd.clear(); Serial. begin(9600); } void loop() { val=analogRead(LM35); temp=val*5; lcd.setCursor(0,0); lcd.print((int)temp/10); lcd.print((char)223); lcd.print("1.Pa"); Serial. println(val); delay(500); vam=analogRead(LM); tem=val*5; lcd.setCursor(0,1); lcd.print((int)tem/10); lcd.print((char)223); lcd.print("2.Pa"); Serial. println(vam); delay(500); if(val<600) { digitalWrite(LED,HIGH); } else { digitalWrite(LED,LOW); } } |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed