תוכן עניינים:

BMP180 Y LCD Con Arduino: 4 שלבים
BMP180 Y LCD Con Arduino: 4 שלבים

וִידֵאוֹ: BMP180 Y LCD Con Arduino: 4 שלבים

וִידֵאוֹ: BMP180 Y LCD Con Arduino: 4 שלבים
וִידֵאוֹ: BMP180 Barometric Pressure/Temperature/Altitude Sensor Module – Arduino + LCD 2024, יולי
Anonim
BMP180 Y LCD קון ארדואינו
BMP180 Y LCD קון ארדואינו

מדריך ההרשאה les ayudará a todos aquellos que quieran hacer funcionar el sensor de temperatura y presión BMP180 y el LCD a través de arduino.

שלב 1: חומרים

para que este programa nos salga bien debemos tener los siguientes materiales:

כבלים

ארדואינו

כבל usb

potenciómetro

LCD

BMP180

מחשב

שלב 2: מונטג '

מונטג '
מונטג '
מונטג '
מונטג '

שלב 3: קודיגו

עבור hacer funcionar el bmp180 y el LCD יכול לראות כמה fusionar dos códigos que son el de hello world y el original del sensor de temperatura bmp180. El código seria ell siguiente:

/* LiquidCrystal Library - שלום עולם

מדגים את השימוש בתצוגת LCD בגודל 16x2. ספריית LiquidCrystal פועלת עם כל צגי LCD התואמים את מנהל ההתקן של Hitachi HD44780. יש הרבה כאלה בחוץ, ובדרך כלל אתה יכול להגיד להם את זה על ידי ממשק 16 פינים.

מערכון זה מדפיס את "שלום עולם!" אל ה- LCD ומראה את השעה.

המעגל: * סיכת LCD RS לפין דיגיטלי 12 * LCD אפשר פין לפין דיגיטלי 11 * פין LCD D4 לסיכה דיגיטלית 5 * פין LCD D5 לסיכה דיגיטלית 4 * פין LCD D6 לסיכה דיגיטלית 3 * פין LCD D7 לסיכה דיגיטלית 2 * סיכת R/W LCD לקרקע * פין LCD VSS לקרקע * סיכת VCC LCD ל 5V * נגדת 10K: * מסתיימת ל- +5V וקרקע * מגב לפין VO VO (פין 3)

הספרייה נוספה במקור 18 באפריל 2008 על ידי David A. Mellis ספרייה שונה 5 ביולי 2009 על ידי לימור פריד (https://www.ladyada.net) דוגמה נוספה 9 ביולי 2009 על ידי טום איגו שונה 22 נובמבר 2010 על ידי טום איגו

קוד דוגמה זה נמצא ברשות הרבים.

www.arduino.cc/en/Tutorial/LiquidCrystal *

/ כלול את קוד הספרייה: #include #include #include

// לאתחל את הספרייה עם המספרים של סיכות הממשק LiquidCrystal lcd (12, 11, 5, 4, 3, 2); לחץ SFE_BMP180;

PresionBase כפול;

Presion כפול = 0; אלטורה כפולה = 0; טמפרטורה כפולה = 0; מעמד צ'ארה;

הגדרת void () {// הגדר את מספר העמודות והשורות של ה- LCD: lcd.begin (16, 2); Serial.begin (9600); SensorStart (); }

לולאת void () {// הגדר את הסמן לעמודה 0, שורה 1 // (הערה: שורה 1 היא השורה השנייה, מכיוון שהספירה מתחילה ב- 0): lcd.setCursor (0, 1); // הדפס את מספר השניות מאז האיפוס: ReadSensor (); // Se imprimen las משתנים

lcd.print ("טמפרטורה:"); lcd.print (טמפרטורה); lcd.println ("grados C"); lcd.print ("Presion:"); lcd.print (Presion); lcd.println ("מיליבארים"); עיכוב (1000); } void SensorStart () {// Secuencia de inicio del sensor if (pressure.begin ()) Serial.println ("הצלחה BMP180 init"); אחרת {Serial.println ("BMP180 init fail (נותק?) n / n"); בעוד (1); } // Se inicia la lectura de temperatura status = pressure.startTemperature (); אם (סטטוס! = 0) {עיכוב (סטטוס); // Se lee una temperatura inicial status = pressure.getTemperature (טמפרטורה); if (status! = 0) {// Se inicia la lectura de presiones status = pressure.startPressure (3); אם (סטטוס! = 0) {עיכוב (סטטוס); // Se lee la presión inicial incident sober el sensor en la primera ejecución status = pressure.getPressure (PresionBase, Temperatura); }}}} void ReadSensor () {// En este método se hacen las lecturas de presión y temperatura y se calcula la altura // Se inicia la lectura de temperatura status = pressure.startTemperature (); אם (סטטוס! = 0) {עיכוב (סטטוס); // Se realiza la lectura de temperatura status = pressure.getTemperature (טמפרטורה); if (status! = 0) {// Se inicia la lectura de presión status = pressure.startPressure (3); אם (סטטוס! = 0) {עיכוב (סטטוס); // Se lleva a cabo la lectura de presión, // considerando la temperatura que afecta el desempeño del sensor status = pressure.getPressure (Presion, Temperatura); if (status! = 0) {// Se hace el cálculo de la altura en base a la presión leída en el Setup} else Serial.println ("error en la lectura de presion / n"); } אחרת Serial.println ("טעות iniciando la lectura de presion / n"); } אחרת Serial.println ("error en la lectura de temperatura / n"); } אחרת Serial.println ("טעות iniciando la lectura de temperatura / n"); }

este es el código del programa, pero instructables no lo deja poner como en realidad es porque quita los espacios que hay entre cada parte del código

שלב 4: תוצאות

תוצאה
תוצאה

סיום, תוכנות מתקן ותכנות לעריכת מסך מבית Arduino le deberá.

מוּמלָץ: