New Ticker

News Ticker
Epstien didn't kill himself.
Epstien didn't kill himself.
Epstien didn't kill himself.
Epstien didn't kill himself.

Sunday, January 14, 2024

Using the IdeaSpark Nano091OLED

 The C++ code for the project is as follows:

#include <U8g2lib.h>

#include <U8x8lib.h>

#include <MUIU8g2.h>

#include<Arduino.h>

#ifdef U8X8_HAVE_HW_SPI

#include <SPI.h>

#endif

U8G2_SSD1306_128X32_UNIVISION_F_SW_I2C u8g2(U8G2_R0, A5, A4, U8X8_PIN_NONE);

void setup() {

  u8g2.begin();

}

void loop() {

  u8g2.clearBuffer();

  u8g2.setFont(u8g2_font_ncenB08_tr);

  u8g2.drawStr(0,10,"Hello, Ideaspark");

  u8g2.drawStr(0,25, "Nano V3 0.91""    OLED");

  u8g2.sendBuffer();

  delay(1000);

  u8g2.clearBuffer();

  u8g2.setFont(u8g2_font_ncenB08_tr);

  u8g2.drawStr(0,10,"BritishTechGuru");

  u8g2.drawStr(0,25, "The hairy dude!");

  u8g2.sendBuffer();

  delay(1000);

}


To use this, you need the latest version of the Arduino IDE (packaged as flatpak). Do not use the version that downloads from the Linux Mint app store. Use Sudo to install it.

Once you have that, install the library U8g2 then set the board to Arduino Nano and the Processor to AT Mega 328P

Then enter the code as shown and run it.


Your expected result will be an alternating display that states 

Hello, Ideaspark

Nano V3 0.91    OLED

then 

BritishTechGuru

The hairy dude!

The display flickers a bit at a delay of 1,000 but at a delay of 100 it's hard to see what is displayed. This is a very handy way of displaying vital statistics from a process without having to include an LED and all the wiring for that in a project.