Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Custom_LSM303 Custom_UBloxGPS LRAT-mbed-os USBDevice mbed-lora-radio-drv stm32EEPROM
Fork of LRAT-example-lorawan by
Diff: main.cpp
- Revision:
- 31:f03c183e2bf6
- Parent:
- 30:ff249a9156dc
- Child:
- 32:f211b8c28273
- Child:
- 33:e47306c32791
--- a/main.cpp Thu Aug 02 23:19:00 2018 +0000 +++ b/main.cpp Fri Aug 03 16:34:24 2018 +0000 @@ -96,9 +96,9 @@ double mylat; double mylon; -#define NEOM8M_ADR_GPS (0x42 >> 1); -#define LSM303_ADR_ACC (0x32 >> 1); -#define LSM303_ADR_MAG (0x3C >> 1); +#define NEOM8M_ADR_GPS (0x42 >> 1) +#define LSM303_ADR_ACC (0x32 >> 1) +#define LSM303_ADR_MAG (0x3C >> 1) I2C i2c(PB_9, PB_8); @@ -197,9 +197,25 @@ time_t tNow = time(NULL); printf("Clock: %d\r\n", tNow); mytime = tNow; - char[1024] buf; - i2c.read(NEOM8M_ADR_GPS, buf, 1024); - printf(buf); + char cmd[2]; + /* + char buf[1024]; + buf[0] = 0x00; + buf[1] = 0x00; + buf[2] = 0x00; + */ + char buf; + //cmd[0] = 0xFF; + //i2c.write(NEOM8M_ADR_GPS, cmd, 1); + //i2c.read(NEOM8M_ADR_GPS, buf, 1024); + cmd[0] = 0x20; + cmd[1] = 0x57; + i2c.write(LSM303_ADR_ACC, cmd, 2); + cmd[0] = 0x20; + i2c.write(LSM303_ADR_ACC, cmd, 1); + i2c.read(LSM303_ADR_ACC, &buf, 1); + //i2c.read(LSM303_ADR_ACC, buf, 1); + printf("Return Value: %02x", buf); int ilat = (int)(mylat * 100000); int ilon = (int)(mylon * 100000); packet_len = 11;