# How to print an infinity symbol to I2C display

I have an I2C display.
This is a simple sketch I use:

``````#include <Wire.h>

#if (SSD1306_LCDHEIGHT != 64)
#endif

void setup() {
// initialize and clear display

}

void loop() {
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(30,12);
display.print("Hello, world!");

// update display with all of the above graphics
display.display();

}
``````

How is it possible to draw an infinity symbol instead of “Hello world!”? I’ve tried to past like this“∞”, but it doesn’t work.

How is it possible to draw an infinity symbol instead of "Hello world!"?

The library uses a default font to display the text. You can look at that font, to see if it has a definition for the infinity symbol (I doubt it). If it does, you'll know the numeric value of the character, and you can print the character by value.

If it does not, you can define one, in the next available slot, and use the value of that position to print the character.

I've checked all the fonts in the library. There is no such a symbol. Are there any mathematical functions?

OP is using an OLED display.

I did it this way:

``````for (int t = 0; t <= 1000; t++) {

float scale = 2 / (3 - cos(2 * t));
int x = 25 * scale * cos(t);
int y = 18 * scale * sin(2 * t) / 2;
display.drawPixel(x + 25, y + 20, WHITE);
display.drawPixel(x + 26, y + 21, WHITE);

}
``````

Couldn't you simply rotate an '8' by 90 degrees?

Tofer:
I did it this way:

``````for (int t = 0; t <= 1000; t++) {
``````

float scale = 2 / (3 - cos(2 * t));
int x = 25 * scale * cos(t);
int y = 18 * scale * sin(2 * t) / 2;
display.drawPixel(x + 25, y + 20, WHITE);
display.drawPixel(x + 26, y + 21, WHITE);

}

Nice !