This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

showing output to sharp lcd boosterpack

Other Parts Discussed in Thread: ENERGIA

I have interfaced Bosch BME 280 with my launchpad which is msp432p401r via i2c ..I am using energia ...I can see the output which is pressure, humidity and temperature through the serial monitor...now I have to show the output through this sharp lcd boosterpack...can anyone help ??

  • For most Energia questions it's a good idea to also (not only) ask here: http://forum.43oh.com/
    I think the library is already included in the newest Energia release (not sure if I added to mine later on). There are examples included with it.

    Though some LCD libraries were not completely compatible with the MSP432, mostly because it uses the new Energia MT
  • Hi,

    There is a link available to the Sharp LCD BP Library,
    energia.nu/.../

    Slight modifications need to be made though to work with the MSP432 launchpad.

    Sincerely,
    Sean
  • Still?

    I "hacked" the library for the Educational Boosterpack just so there weren't any compiling warnings (or how they are called) - but for some reason it takes like a full 3-4 seconds to update the screen (I think I checked the SPI speed and it seemed fine)
    Do you know if the same happens with the Sharp, with that LCD library?
  • Hi Mohammed,

    just saw your private message that pointed me to this thread. Great Luis and Sean offered some help already!
  • Hi Mohammad,
    Just another note, CCS resource explorer does have the complete lcd boosterpack library to use with the MSP432 launchpad, you can use it as reference during your design.

    dev.ti.com/.../


    Sincerely,
    Sean

  • I have tried combining my sensor code and the example code of the display , but i havent been able to find the output ...i am providing all the codes here ...
    this is the code for my environmental sensor
    #include <Wire.h>
    #include "cactus_io_BME280_I2C.h"

    // Create BME280 object
    BME280_I2C bme; // I2C

    void setup() {

    Serial.begin(9600);
    Serial.println("Bosch BME280 Pressure - Humidity - Temp Sensor | cactus.io");

    if (!bme.begin(0X76)) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
    }

    Serial.println("Pressure\tHumdity\t\tTemp\ttTemp");
    }

    void loop() {

    Serial.print(bme.getPressure() / 100.0F); Serial.print(" mb\t"); // Pressure in millibars
    Serial.print(bme.getHumidity()); Serial.print(" %\t\t");
    Serial.print(bme.getTemperature_C()); Serial.print(" *C\t");
    Serial.print(bme.getTemperature_F()); Serial.println(" *F");

    // Add a 2 second delay. delay(2000); //just here to slow down the output.
    }

    this is the lcd exaple code

    // Include application, user and local libraries
    #include "SPI.h"
    #include "OneMsTaskTimer.h"
    #include "LCD_SharpBoosterPack_SPI.h"

    // Variables
    LCD_SharpBoosterPack_SPI myScreen;
    uint8_t k = 0;
    uint16_t count = 0;


    // Add setup code
    void setup() {
    myScreen.begin();

    myScreen.setFont(1);
    myScreen.text(10, 10, "Hello!");
    myScreen.flush();

    delay(1000);
    myScreen.clear();
    }

    // Add loop code
    void loop() {
    k++;
    myScreen.clearBuffer();
    myScreen.setFont(0);
    myScreen.text(k, 10, "ABCDE", LCDWrapNone);
    for (uint8_t i=10; i<LCD_HORIZONTAL_MAX-10; i++) {
    myScreen.setXY(i,20,1);
    }

    myScreen.text(10,30,String(count++,10));

    for (uint8_t i=0; i<=20; i++) {
    myScreen.setXY(50+i,30,1);
    }
    for (uint8_t i=0; i<=20; i++) {
    myScreen.setXY(50,30+i,1);
    }
    for (uint8_t i=0; i<=20; i++) {
    myScreen.setXY(50+i,50,1);
    }
    for (uint8_t i=0; i<=20; i++) {
    myScreen.setXY(70,30+i,1);
    }

    myScreen.setFont(1);
    myScreen.setCharXY(10, 40);
    myScreen.print("ABC");
    myScreen.setFont(0);
    myScreen.setCharXY(60, 60);
    myScreen.print(0x7F, HEX);
    myScreen.print(0x81, HEX);
    myScreen.setCharXY(10, 60);
    myScreen.println("Break!");
    myScreen.print("ABC\nabc");
    myScreen.flush();
    delay(200);
    }


    this is the merged code

    #include <Wire.h>
    #include "cactus_io_BME280_I2C.h"
    #include "SPI.h"
    #include "OneMsTaskTimer.h"
    #include "LCD_SharpBoosterPack_SPI.h"

    // Create BME280 object
    BME280_I2C bme; // I2C

    // Variables
    LCD_SharpBoosterPack_SPI myScreen;
    uint8_t k = 0;
    uint16_t count = 0;

    void setup() {

    Serial.begin(9600);
    Serial.println("Bosch BME280 Pressure - Humidity - Temp Sensor | cactus.io");

    if (!bme.begin(0X76)) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
    myScreen.begin();

    myScreen.setFont(1);
    myScreen.text(10, 10, "bme.getTemperature_C()); Serial.print(" *C\t"!");
    myScreen.flush();

    delay(1000);
    myScreen.clear();

    }

    Serial.println("Pressure\tHumdity\t\tTemp\ttTemp");
    }

    void loop() {

    Serial.print(bme.getPressure() / 100.0F); Serial.print(" mb\t"); // Pressure in millibars
    Serial.print(bme.getHumidity()); Serial.print(" %\t\t");
    Serial.print(bme.getTemperature_C()); Serial.print(" *C\t");
    Serial.print(bme.getTemperature_F()); Serial.println(" *F");

    // Add a 2 second delay. delay(2000); //just here to slow down the output.
    k++;
    myScreen.clearBuffer();
    myScreen.setFont(0);
    myScreen.text(k, 10, "bme.getTemperature_C()); Serial.print(" *C\t"", LCDWrapNone);
    for (uint8_t i=10; i<LCD_HORIZONTAL_MAX-10; i++) {
    myScreen.setXY(i,20,1);
    }

    myScreen.text(10,30,String(count++,10));

    for (uint8_t i=0; i<=20; i++) {
    myScreen.setXY(50+i,30,1);
    }
    for (uint8_t i=0; i<=20; i++) {
    myScreen.setXY(50,30+i,1);
    }
    for (uint8_t i=0; i<=20; i++) {
    myScreen.setXY(50+i,50,1);
    }
    for (uint8_t i=0; i<=20; i++) {
    myScreen.setXY(70,30+i,1);
    }

    myScreen.setFont(1);
    myScreen.setCharXY(10, 40);
    myScreen.print("bme.getTemperature_C()); Serial.print(" *C\t"");
    myScreen.setFont(0);
    myScreen.setCharXY(60, 60);
    myScreen.print(0x7F, HEX);
    myScreen.print(0x81, HEX);
    myScreen.setCharXY(10, 60);
    myScreen.println("Break!");
    myScreen.print("bme.getTemperature_C()); Serial.print(" *C\t"\nabc");
    myScreen.flush();
    delay(200);

    }

    can anone help ??
  • Hi Mohammed,

    Does the sensor and display code work individually? Are you getting no output on the screen when the code is combined?

    Sincerely,
    Sean
  • Hi Sean 

    The codes working individually ..but no output when combined 

  • Did you check if the code continues running in the background? Means looking into it with the debugger to see if fresh data is coming from the sensor, for example? Or does it get stuck somewhere?

  • i can see the sensor output via serial monitor
  • And it changes? Only the LCD does not show something? But it does when only outputting things without the sensor?
  • i can run the example code of the lcd which shows hello in the screen ...if i run the sensor code without display ..i can see the sensor output via serial monitor but ..when i have combined the codes and tried to show the output via the lcd it does not show any output ...i have provided the code below :

    #include <Wire.h>
    #include "cactus_io_BME280_I2C.h"
    #include "SPI.h"
    #include "OneMsTaskTimer.h"
    #include "LCD_SharpBoosterPack_SPI.h"

    // Create BME280 object
    BME280_I2C bme; // I2C

    // Variables
    LCD_SharpBoosterPack_SPI myScreen;
    uint8_t k = 0;
    uint16_t count = 0;


    void setup() {

    Serial.begin(9600);
    Serial.println("Bosch BME280 Pressure - Humidity - Temp Sensor | cactus.io");

    if (!bme.begin(0X76)) {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
    myScreen.begin();
       
        myScreen.setFont(1);
        //myScreen.text(10, 10, "bme.getTemperature_C()); Serial.print(" *C\t"!");
        myScreen.flush(); 
       
        delay(2000);
        myScreen.clear();
    }

    Serial.println("Pressure\tHumdity\t\tTemp\ttTemp");
    }

    void loop() {

    double pressure_t = bme.getPressure() / 100.0F; //save the pressure value to a variable
    double humidity_t = bme.getHumidity();
    double temp_t = bme.getTemperature_C();

    Serial.print(pressure_t); Serial.print(" mb\t"); // Print the pressure in serial
    Serial.print(humidity_t); Serial.print(" %\t\t");
    Serial.print(temp_t); Serial.print(" *C\t");

    char buf[32];
    dtostrf(pressure_t,3,2,buf);
    String pres = String(buf) ;

    myScreen.clearBuffer();

    for(int i = 0 ; i < pres.length() ; i++)
    {
    myScreen.text(k, 10, pres[i]); //this should print the pressure in screen.
    }
    k++;
    myScreen.flush(); 
    delay(5000); //random delay


    myScreen.println(temp_t,DEC); //this should print the temp..

    myScreen.flush();
    delay(5000); //random delay

    myScreen.clear();

    }
  • What does the debugger tell you? If you step through the code, does it reach the function for outputting data to the LCD? What happens? What if you comment out the readings of the sensor and simply output a fixed constant?
  • i am not sure how to do that

**Attention** This is a public forum