Linee, rettangoli e cerchi
Disegni forme per creare una semplice interfaccia utente.
Linee, rettangoli e cerchi è una lezione Arduino & IoT Academy gratuita su CoddyKit. Questa è la lezione 3 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Arduino & IoT Academy, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Arduino & IoT Academy include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
Beyond Text
Text alone gets dull. The GFX library also draws shapes, so you can frame data, build meters, and design a real little interface. 🎨
The Pixel Grid
Every shape lives on a coordinate grid. Point (0,0) is top-left; x runs right and y runs down, just like the text cursor you already used.
Draw a Single Pixel
The smallest mark is one dot. drawPixel takes an x, a y, and a color, lighting exactly one point on the screen.
display.drawPixel(10, 10, WHITE);Draw a Line
drawLine connects two points. Give a start x and y, an end x and y, and a color to stroke a straight line between them.
display.drawLine(0, 0, 127, 63, WHITE);Outline a Rectangle
drawRect needs a top-left x and y, then a width and height. It strokes just the border, perfect for framing a value or a section.
display.drawRect(0, 0, 60, 30, WHITE);Fill a Rectangle
Swap to fillRect with the same arguments to paint the whole box solid. Filled bars are the heart of meters and progress displays.
display.fillRect(0, 0, 60, 30, WHITE);Outline a Circle
drawCircle takes a center x and y plus a radius. It strokes a ring, handy for dials, status dots, or rounded icons.
display.drawCircle(64, 32, 20, WHITE);Fill a Circle
Use fillCircle for a solid disc. A small filled circle makes a clear on/off indicator that is easy to read at a glance.
display.fillCircle(64, 32, 5, WHITE);Rounded Rectangles
For a softer look, drawRoundRect adds a corner radius after width and height. Rounded boxes make buttons and cards feel friendlier.
display.drawRoundRect(0, 0, 60, 30, 8, WHITE);Layer Shapes and Text
Order matters: shapes drawn later sit on top. Draw a filled box first, then print text over it for a labeled badge effect.
display.fillRect(0, 0, 50, 16, WHITE);
display.setTextColor(BLACK);Then Push to Screen
As always, all drawing fills the buffer. End your shape work with display.display() so the whole composed image appears at once.
display.display();Quick Check
You want a solid bar to show how full a tank is.
Recap
You can now draw pixels, lines, rectangles, and circles, and layer shapes with text. These primitives are all you need to compose a real UI.
Domande Frequenti
La lezione «Linee, rettangoli e cerchi» è gratuita?
Sì — il testo completo di «Linee, rettangoli e cerchi» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Arduino & IoT Academy, passa a CoddyKit PRO. Il corso Arduino & IoT Academy include 4 lezioni in totale.
Cosa imparerò in «Linee, rettangoli e cerchi»?
Disegni forme per creare una semplice interfaccia utente. Eserciti Arduino & IoT Academy con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Arduino & IoT Academy?
Non è richiesta alcuna esperienza precedente. Arduino & IoT Academy su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 3 di 4.
Quanto tempo richiede la lezione «Linee, rettangoli e cerchi»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Arduino & IoT Academy?
Sì. Ogni lezione Arduino & IoT Academy include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Collegare e inizializzare un OLED SSD1306
- Disegnare testo in più dimensioni
- Linee, rettangoli e cerchi
- Animare un grafico a barre