BMP + GPS + EPAPER
Posted: Thu Nov 23, 2023 12:14 pm
Good morning everyone, I need to put together an espressif wroom 32 board with a BMP sensor and a Neo6 GPS and display the data on an e-paper screen. I have the problem that both the GPS and the display have a connection to the pins on RX2 and TX2. Taken individually, both work correctly, but I can't find a way to move one of the two to other pins. Can anyone help me please.
Ton
Ton
Code: Select all
/*
PIN E-PAPER
BUSY D4
RES RX2
D/C TX2
CS D5
SCL 22
SDA 23
VCC +3.3
GND GND
PIN GPS
TX RX2
RX TX2
VCC +3.3
GND GND
*/
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include <GxEPD2_BW.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <TinyGPSPlus.h>
#define BMP_SDA 21
#define BMP_SCL 22
TinyGPSPlus gps;
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 296
#define ALTITUDE_SEA_LEVEL 1013.25 // Imposta il livello del mare in hPa
Adafruit_BMP280 bmp; // Oggetto BMP280
GxEPD2_BW<GxEPD2_290_BS, GxEPD2_290_BS::HEIGHT> display(GxEPD2_290_BS(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // DEPG0290BS 128x296, SSD1680
void setup() {
Serial.begin(115200);
Serial2.begin(115200);
delay(100);
if (!bmp.begin()) {
Serial.println("Impossibile trovare il sensore BMP280. Verifica le connessioni!");
while (1);
}
display.init(115200);
display.setRotation(1);
}
void loop() {
float temperature = bmp.readTemperature();
float pressure = bmp.readPressure() / 100.0F; // Converti la pressione in hPa
float altitude = bmp.readAltitude(ALTITUDE_SEA_LEVEL);
display.clearScreen();
display.fillScreen(GxEPD_WHITE);
display.setFont(&FreeMonoBold9pt7b);
display.setTextColor(GxEPD_BLACK);
display.setCursor(0, 30);
display.print("Altitudine:");
display.setCursor(0, 60);
display.print(gps.altitude.meters(), 0);
display.print(" m");
display.display();
delay(1000);
}