Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temperature not working #20

Open
koos147 opened this issue Dec 30, 2021 · 0 comments
Open

temperature not working #20

koos147 opened this issue Dec 30, 2021 · 0 comments

Comments

@koos147
Copy link

koos147 commented Dec 30, 2021

Good day,

i have a Sodaq one Version 2.
at the temperature it always reported a nice 20 degrees.

when i changed the getBoardTemperature function to bellow. it reports an rawTemp of -1
when checking the bellow page it shows an LIS3DE instead of an LSM303
https://support.sodaq.com/Boards/One/#summary
Is this device capable of measuring the temperature?


int8_t getBoardTemperature()
{
    setLsm303Active(true);

    uint8_t tempL = lsm303.readReg(LSM303::TEMP_OUT_L);
    uint8_t tempH = lsm303.readReg(LSM303::TEMP_OUT_H);

    // Note: tempH has the 4 "unused" bits set correctly by the sensor (0x0 or 0xF)
    int16_t rawTemp = ((uint16_t)tempH << 8) | tempL;

    setLsm303Active(false);
      #ifdef DEBUG
        consolePrint("temperature: ");
        consolePrintln(rawTemp);
      #endif

    return round(TEMPERATURE_OFFSET + rawTemp / 8.0);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant