Desenhe texto em vários tamanhos
Exiba rótulos e valores em diferentes escalas.
Desenhe texto em vários tamanhos é uma aula grátis de Arduino & IoT Academy no CoddyKit. Esta é a aula 2 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Arduino & IoT Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Arduino & IoT Academy inclui 4 aulas no total.
Partes desta aula ainda não foram traduzidas e aparecem em inglês.
Text Is Just Pixels
The OLED has no letters built in. The GFX library paints each character as a tiny pattern of pixels, so you control exactly how text looks. ✍️
Pick a Text Color
On a monochrome OLED, color means on or off. Call setTextColor with WHITE so your letters light up against the dark background.
display.setTextColor(WHITE);Set the Text Size
setTextSize(1) draws the base 6x8 pixel font. Larger numbers scale that same shape up, trading sharpness for readability from a distance.
display.setTextSize(1);How Size Scaling Works
Size 2 doubles every pixel, so a letter becomes 12x16. Size is a whole-number multiplier, not a point value, so jumps are chunky but predictable.
Place the Cursor
setCursor(x, y) sets where the next text starts. The top-left corner is (0,0), and x grows right while y grows down the screen.
display.setCursor(0, 0);Print Some Text
Now write words with print or println. They behave like the Serial Monitor, but the output lands on your OLED at the cursor.
display.print("Hello!");Print Numbers Too
You can pass variables straight to print. Mix labels and values to show live data like a temperature reading right on the screen.
display.print("Temp: ");
display.print(temp);A Bold Title
Combine a big title with small details below. Use size 2 for a headline, then drop back to size 1 for the data lines underneath.
display.setTextSize(2);
display.setCursor(0, 0);
display.print("STATUS");Move to a New Line
The cursor does not auto-wrap nicely for layouts. For a clean second line, call setCursor again with a larger y value to drop down.
display.setCursor(0, 20);Always Refresh
Remember the rhythm: clearDisplay, set size and cursor, print, then display. Skip the final display and your fresh text never shows up.
display.clearDisplay();
display.print("Ready");
display.display();Mind the Edges
Big text eats space fast. A size-2 line is 16 pixels tall, so on a 64-pixel screen you fit only a few rows before running off the bottom.
Quick Check
You want letters twice as tall as the default font.
Recap
You set color, chose a text size, positioned the cursor, and printed labels with values. Headlines big, data small, always end with display.
Perguntas Frequentes
A aula “Desenhe texto em vários tamanhos” é grátis?
Sim — o texto completo de “Desenhe texto em vários tamanhos” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Arduino & IoT Academy, atualize para CoddyKit PRO. O curso de Arduino & IoT Academy inclui 4 aulas no total.
O que vou aprender em “Desenhe texto em vários tamanhos”?
Exiba rótulos e valores em diferentes escalas. Você pratica Arduino & IoT Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.
Preciso ter experiência prévia para começar Arduino & IoT Academy?
Nenhuma experiência prévia é necessária. Arduino & IoT Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 2 de 4.
Quanto tempo leva a aula “Desenhe texto em vários tamanhos”?
A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.
Posso escrever e executar código nesta aula de Arduino & IoT Academy?
Sim. Cada aula de Arduino & IoT Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.
Todas as aulas deste curso
- Conecte e inicialize um OLED SSD1306
- Desenhe texto em vários tamanhos
- Linhas, retângulos e círculos
- Anime um gráfico de barras