![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Ognjen Arbutina 2020/0581
Dependencies: mbed-os Adafruit_GFX
Diff: main.cpp
- Revision:
- 0:319b30195b43
diff -r 000000000000 -r 319b30195b43 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Dec 11 15:53:44 2021 +0000 @@ -0,0 +1,50 @@ +//UVOZ BIBLIOTEKA + +#include "mbed-os" +#include "Adafruit_GFX.h" +#include "Adafruit_GFX_Config.h" +#include "Adafruit_SSD1306.h" + +//DEFINISANJE MAKROA + +//Lnije za implementaciju I2C protokola + +#define SDA PB_13 +#define SCL PB_14 + +//dimenzije OLED displeja + +#define OLED_HEIGHT_PX 128 +#define OLED_WIDTH_PX 64 + +//Adrese + +#define I2C_adress 0x3c +#define I2c_adress_MBED I2C_adress << 1 + +//Dimenzije kruga + +#define x0 30 +#define y0 30 +#define r 10 +#define color WHITE + +#define WAIT_MS 10 + +//DEFINISANJE KLASA + +I2C i2c_obj(SDA, SCL); +Adafruit_SSD1306_I2c myOLED(i2c_obj, PB_5, I2c_adress_MBED,OLED_HEIGHT_PX, OLED_WIDTH_PX ) ; + +//GLAVNI PROGRAM + +int main() +{ + myOLED.begin(); + while(1) + { + myOLED.drawCircle(x0, y0, r, color); + myOled.display(); + wait_ms(WAIT_MS); + } +}