Hello, I have an STM32 F103RB board and I have a program that measures temperature values and outputs it in Celsius onto Putty but I was wondering how I would take that data and output it onto a 16x2 I2C LCD display using the MBed comiler. Any help would be appreciated and thank you in advance.
how is written on I2C API page , be sure about correct address format
Note: The Arm Mbed API uses 8 bit addresses, so make sure to left-shift 7 bit addresses by 1 bit before passing them
Example:
#include "mbed.h"
#include "TextLCD.h"
DigitalOut led(LED1);
I2C i2cBus(I2C_SDA, I2C_SCL);
TextLCD_I2C lcd(&i2cBus, PCF8574A_SA7, TextLCD::LCD16x2); // PCF8574A_SA7 is gpio expander i2c address from a macro what is defined in TextLCD_Config.h
int main(){
printf("LCD Hello\n");
lcd.cls();
lcd.setBacklight(TextLCD::LightOn);
lcd.printf("LCD Hello\n");
while(1) {
thread_sleep_for(500);
led = !led;
}
}
For temperature you can use same printf like you used in your example.