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: mbed UIT_ADT7410
main.cpp
- Committer:
- MikamiUitOpen
- Date:
- 2020-04-02
- Revision:
- 12:9a71c11c8e92
- Parent:
- 11:632e038543e3
- Child:
- 13:7f89953302c5
File content as of revision 12:9a71c11c8e92:
//--------------------------------------------------------------
// ADT7410 and LCD display using I2C interface
// mbed revision: 172
// 2020/04/02, Copyright (c) 2020 MIKAMI, Naoki
//--------------------------------------------------------------
#pragma diag_suppress 870 // マルチバイト文字使用の警告を抑制
#include "ADT7410.hpp"
using namespace Mikami;
// If you want to display the temperature on AQM1602,
// enable following #define statement
#define USING_AQM1602
#ifdef USING_AQM1602
#include "AQM1602.hpp"
Aqm1602 lcd_; // using default I2C port
#endif // #ifdef USING_AQM1602
ADT7410 tempr_; // using default I2C port
int main()
{
printf("\r\nStart ADT7410\r\n");
#ifdef USING_AQM1602
bool on = true;
lcd_.WriteStringXY("ADT7410", 0, 0);
#endif // #ifdef USING_AQM1602
// Confirmation of setting
uint8_t cReg = tempr_.GetConfig();
printf("Mode: 0x%02x\r\n", cReg);
while (true)
{
// float value = tempr_.Read(); // Member function version
float value = tempr_; // Operator version
#ifdef USING_AQM1602
lcd_.WriteValueXY("%5.1f \xDF""C", value, 0, 1);
if (on) lcd_.WriteStringXY(".", 15, 0);
else lcd_.WriteStringXY(" ", 15, 0);
on = !on;
#endif // #ifdef USING_AQM1602
printf("%5.1f [℃]\r\n", value);
wait(1);
}
}