Hello,
Yes, I seem to be one of many who might have asked such a question and I also went through a lot of time and forum pages to come to the point where I am now. I dont know much about Arduinos, OLEDs and especially coding. Though, honestly Im quite proud about how far Ive come.
I am making myself a ITX PC which includes an Arduino Nano linked to an OLED on which I want to display CPU temps, GPU temps, date and time. (Arduino is linked to the PC with a USB all the time.)
For the CPU/GPU part im thinking of following link 1 (see below). Again, Im very inexperienced. So much so that even the seemingly simplest guides are jibberish for me. Thus Im not working on whats mentioned in link 1 for now. If someone can help me with the mentioned guide, please do.
For the date and time Im using a programme called "gobetwino". Thisll be running in the background and wait for the command from the Arduino, once recieved itll sent back the current time. I figured out how to send a command and get it on the OLED in some form. (see below for the code.) However its not in the form id like it to be on the display. (Again, see below for an example.)
My questions:
How do I store the data sent from the PC?
How do I display the stored data from the Arduino displayed on the OLED?
How do I control the above each second, so the displayed time is correct?
If youre willing, the same questions but then for the CPU/GPU temps.
Hardware:
AZDelivery Arduino Nano V3.0 CH340
TZT OLED 3.12" 256x64
Link 1: Arduino PC Monitor - Arduino Project Hub
Example of displaying the data on the OLED:
CPU 60C 09-02-22
GPU 65C 19:36:21
The frankenstein code: (please note that its for displaying time only)
#include <Arduino.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
U8G2_SSD1322_NHD_256X64_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 5, /* dc=*/ 3, /* reset=*/ 4);
#define U8LOG_WIDTH 8
#define U8LOG_HEIGHT 8
uint8_t u8log_buffer[U8LOG_WIDTH*U8LOG_HEIGHT];
U8G2LOG u8g2log;
void setup(void)
{
Serial.begin(9600);
u8g2.begin();
u8g2.setFont(u8g2_font_5x7_tr);
u8g2.setFlipMode(1);
u8g2log.begin(u8g2, U8LOG_WIDTH, U8LOG_HEIGHT, u8log_buffer);
u8g2log.setLineHeightOffset(0);
u8g2log.setRedrawMode(1);
}
void loop(void)
{
Serial.println("#S|T|[]#");
delay(500);
char c;
if (Serial.available() >= 8) {
c = Serial.read();
u8g2log.print(c);
}
}