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: Rm3100 SPI_TFT_ILI9341 TFT_fonts
Fork of Hello_RM3100 by
main.cpp
- Committer:
- x893
- Date:
- 2018-03-06
- Revision:
- 1:6d43a9476f67
- Parent:
- 0:f939d6b78be6
File content as of revision 1:6d43a9476f67:
#include "mbed.h" #include "Rm3100.hpp" #include "SPI_TFT_ILI9341.h" #include "string" #include "Arial24x23.h" // mosi, miso, sclk, cs, reset, dc SPI_TFT_ILI9341 TFT(D8, D9, D10, D11, D12, D8); int main(void) { Serial pc(USBTX, USBRX); pc.baud(115200); printf("### RM3100 ###\r\n"); TFT.set_font((unsigned char*) Arial24x23); // select font 2 TFT.locate(48,115); TFT.printf("Bigger Font"); int addr = ((Rm3100::RM3100_ADDR | Rm3100::RM3100_ADDR_SSN) << 1); struct Rm3100::Status status = { 0 }; struct Rm3100::Sample sample = { 0 }; Rm3100 sensor(I2C_SDA, I2C_SCL, addr); sensor.Begin(); osDelay(1); sensor.SetCycleCounts(200); osDelay(1); sensor.SetRate(100.0f); osDelay(1); sensor.SetContinuousMeasurementMode(true); osDelay(1); while (true) { sensor.GetStatus(&status); if (status.drdy) { sensor.GetSample(&sample); printf("x: %f, y: %f, z: %f\r\n", sample.x, sample.y, sample.z); } osDelay(10); } }