Tinyscreen+ Circles

jgavlik

  • Sr. Member
  • ****
    • Posts: 68
    • View Profile
Is there a way to draw a circle on the Tinyscreen+ display?

-john


Volcanology

  • Newbie
  • *
    • Posts: 1
    • View Profile
Yes, there is a way to draw a circle on the Tinyscreen+ display, which is a color OLED display for the TinyDuino system https://learn.tinycircuits.com/Display/TinyScreen_TinyShield_Tutorial/. You can use the TinyScreen library, which is a library that supports both the OLED screen and the buttons on the board https://github.com/TinyCircuits/TinyCircuits-TinyScreenPlus-ASM2022/blob/master/examples/TinyScreenBasicExample/TinyScreenBasicExample.ino. The library has a function called drawCircle, which can draw a circle with a specified center, radius, and color. Here is an example code that can draw a circle on the Tinyscreen+ display:
geometry dash
#include <Wire.h>
#include <SPI.h>
#include <TinyScreen.h>

//Create a TinyScreen object
TinyScreen display = TinyScreen(TinyScreenPlus);

//Define the center, radius, and color of the circle
int centerX = 48; //The center x coordinate, from 0 to 95
int centerY = 32; //The center y coordinate, from 0 to 63
int radius = 20; //The radius of the circle, from 0 to 31
int color = TS_8b_White; //The color of the circle, using TS library color definitions

void setup() {
//Initialize the display
display.begin();
//Set the display to normal mode
display.setFlip(0);
//Clear the display
display.clearScreen();
//Draw a circle on the display
display.drawCircle(centerX, centerY, radius, color);
}

void loop() {
//Do nothing
}

I hope this helps.
« Last Edit: January 22, 2024, 09:48:20 PM by Volcanology »


 

SMF spam blocked by CleanTalk