Hello! I have a problem with getting WiFi functionality in a project for my Wio Terminal. I started with making the Seeed BME680 sensor work on it, this was possible by changing the code from Lesson 12 of the Wio Terminal wiki.
This is the code I use:
#include “seeed_bme680.h”
#include “TFT_eSPI.h” //TFT LCD library#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10#define IIC_ADDR uint8_t(0x76)
TFT_eSPI tft; //Initializing TFT LCD
TFT_eSprite spr = TFT_eSprite(&tft); //Initializing buffer/** NOTE!!! Select the communication protocol correctly **/
Seeed_BME680 bme680(IIC_ADDR); /* IIC PROTOCOL /
//Seeed_BME680 bme680; / SPI PROTOCOL */
//Seeed_BME680 bme680(BME_CS, BME_MOSI, BME_MISO, BME_SCK);/SPI PROTOCOL/void setup() {
delay(100);
while (!bme680.init()) {
Serial.println(“bme680 init failed ! can’t find device!”);
delay(10000);
}
tft.begin(); //Start TFT LCD
tft.setRotation(3); //Set TFT LCD rotation
spr.createSprite(TFT_HEIGHT,TFT_WIDTH); //Create buffer
}void loop() {
//Setting the title header
spr.fillSprite(TFT_WHITE); //Fill background with white color
spr.fillRect(0,0,320,50,TFT_DARKGREEN); //Rectangle fill with dark green
spr.setTextColor(TFT_WHITE); //Setting text color
spr.setTextSize(3); //Setting text size
spr.drawString(“BME680”,50,15); //Drawing a text stringspr.drawFastVLine(150,50,190,TFT_DARKGREEN); //Drawing verticle line
spr.drawFastHLine(0,140,320,TFT_DARKGREEN); //Drawing horizontal line//Setting temperature
spr.setTextColor(TFT_BLACK);
spr.setTextSize(2);
spr.drawString(“Temperature”,10,65);
spr.setTextSize(2);
spr.drawNumber(bme680.sensor_result_value.temperature,10,95); //Display temperature values
spr.drawString(“C”,80,95);//Setting humidity
spr.setTextSize(2);
spr.drawString(“Humidity”,10,160);
spr.setTextSize(2);
spr.drawNumber(bme680.sensor_result_value.humidity,10,190); //Display humidity values
spr.drawString("%RH",80,190);//Setting pressure
spr.setTextSize(2);
spr.drawString(“Pressure”,160,65);
spr.setTextSize(2);
spr.drawNumber(bme680.sensor_result_value.pressure / 100,160,95); //Display sensor values as percentage
spr.drawString(“hPa”,230,95);//Setting gas
spr.setTextSize(2);
spr.drawString(“Gas”,160,160);
spr.setTextSize(2);
spr.drawNumber(bme680.sensor_result_value.gas / 1000,160,190); //Display sensor values as percentage
spr.drawString(“KohmS”,230,190);spr.pushSprite(0,0); //Push to LCD
delay(50);if (bme680.read_sensor_data()) { Serial.println("Failed to perform reading :("); return; } Serial.print("temperature ===>> "); Serial.print(bme680.sensor_result_value.temperature); Serial.println(" C"); Serial.print("pressure ===>> "); Serial.print(bme680.sensor_result_value.pressure / 1000.0); Serial.println(" KPa"); Serial.print("humidity ===>> "); Serial.print(bme680.sensor_result_value.humidity); Serial.println(" %"); Serial.print("gas ===>> "); Serial.print(bme680.sensor_result_value.gas / 1000.0); Serial.println(" Kohms"); Serial.println(); Serial.println(); delay(2000);
}
Now I want the Wio Terminal to connect to my MQTT server to send the BME680 values, however, after the first step, which is for me to add the line #include "rpcWiFi.h"
to my code, I have the problem that the LCD screen stays blank after uploading the code, which doesn’t work for me as I also want to use the LCD screen as before.
Does anybody have an idea how to solve this problem?