11 years, 2 months ago.

Broken Something and need to understand what please?

I've had this problem for the last couple of days now and I know it isn't hardware related after the exhaustive testing I've applied. The following program has red text showing up for 'TextLCD.cpp' in the program workspace and I can't get any text on the LCD display? I'm using the latest revision for Wim's TextLCD library in other programs and it's displaying characters fine? Can someone please point out the obvious? Incidentally is it bad practice to have say 3 or 4, 26 to 28kb files in the mbed at the same time? Is it always best to just run the one fie? Many Thanks Degs

#include "mbed.h"
#include "TextLCD.h"
#include "SRF08.h"
#include "HMC6352.h"
#include "TMP102.h"
#include "GPS.h"

TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7
SRF08 srf08(p28, p27, 0xE0);
HMC6352 compass(p28, p27);
TMP102 temperature(p28, p27, 0x90); //A0 pin is connected to ground
Serial pc(USBTX, USBRX);
GPS gps(p13, p14);

float RangeReading()
{
    float value;
    value = srf08.read();
    return (value);
}


int main()
{   float distance = 0;

    lcd.printf("Start HMC6352 test...");
    
    //Continuous mode, periodic set/reset, 20Hz measurement rate.
    compass.setOpMode(HMC6352_CONTINUOUS, 1, 20);

    while (1) {
        distance = RangeReading();
        lcd.cls();
        lcd.printf("Range: %2.f cm\n",distance); //f=decimal floating point lower case
        wait(2.0);
        lcd.printf("Heading: %.1f\n", compass.sample() / 10.0); //was just %f
        wait(2.0);
        lcd.printf("Temp: %2.f", temperature.read());
        wait(2.0);
        lcd.cls();
        
        if(gps.sample()) {
            lcd.printf("I'm at %2.f, %2.f\n", gps.longitude, gps.latitude); //was just %f
        } else {
            lcd.printf("Oh Dear! No lock :(\n");
        }
        wait(2.0);
        lcd.cls();
        lcd.printf("ReScan For Data \n");
        wait(1.0);
    }
}

Oh and one more please, when I compile a couple of my programs I get this message prior to 'success' and I'd like to know it's relevance?

members and base-classes will be initialized in declaration order, not in member initialisation list order

2 Answers

11 years, 2 months ago.

Hey Derek, The red filename I think means that you changed something then imported a new revision of the library and there was a conflict, although I'm not sure as some files have gone red and never changed back to black in my project but it still works, Have you tried deleting then importing the library again?

You can have as many files on the mbed as fits, it will choose the newest one,

The error message tells you that a class you are using is initialising members in a different order then they are declared, and they will be initialised in the order they are declared instead. It shouldn't be a problem, the initialiser list in part of the constructor if you want to change there order.

Accepted Answer

Thanks for that Chris, I've also just found out how voltage dependent things are! Changed from my rechargeable batteries to my power supply and hey presto I have text but still now working as I expect so maybe post again on this thread for further help.

posted by Derek Calland 16 Feb 2013

No problem, glad to help

posted by Chris Pepper 16 Feb 2013
11 years, 2 months ago.

Doh! Now I get it, I changed to a 20x4 from a 16x4 in the TextLCD.h library so that must be the difference!