/* Laurien Hofkens 7/10/2024
* OLED Hello world (met library voor WOKWI en in onze klas)
*/
#include <U8g2lib.h> // Library voor OLED display
#include <Wire.h> // Library voor I2C
// 1 van de 2 heb je nodig
//U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); // OLED voor WOKWI
U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); // OLED in klas/labo
int sensorPin = A0;
int value = 0;
int straal = 0;
void setup(void)
{
u8g2.begin(); // initialiseer OLED
}
void loop(void)
{
value = analogRead(sensorPin);
straal = map(value,0,1023,0,20);
u8g2.clearBuffer(); // clear the internal memory
//u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
//u8g2.drawStr(45,38,"Laurien"); // write something to the internal memory
//u8g2.drawFrame(42,27,47,15);
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.setCursor(0, 15);
u8g2.print(value);
u8g2.setFont(u8g2_font_unifont_t_symbols);
u8g2.drawGlyph(2,60, 0x2603); /* dec 9731/hex 2603 Snowman */
u8g2.drawCircle(60, 25, straal, U8G2_DRAW_ALL);
u8g2.sendBuffer(); // transfer internal memory to the display
delay(1000); // 1 seconde wachten
}