/*
ESP32 HTTPClient Jokes API Example
https://wokwi.com/projects/342032431249883731
Copyright (C) 2022, Uri Shaked
*/
#include <WiFi.h>
#include <HTTPClient.h>
#include "U8glib.h"
const char* ssid = "Wokwi-GUEST";
const char* password = "";
#define BTN1_PIN 5
#define BTN_PIN 5
#define TFT_DC 2
#define TFT_CS 15
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_DEV_0 | U8G_I2C_OPT_NO_ACK | U8G_I2C_OPT_FAST); // Fast I2C / TWI
const String url = "https://v2.jokeapi.dev/joke/Programming";
int progress = 0;
void setup() {
u8g.setFont(u8g_font_tpssb);
u8g.setColorIndex(1);
pinMode(BTN_PIN, INPUT_PULLUP);
}
void loop() {
u8g.firstPage();
// if (digitalRead(BTN_PIN) == LOW) {
// nextJoke(tft);
// }
do {
u8g.drawStr(25, 50, "Progress Bar");
u8g.drawFrame(0, 10, 128, 20);
u8g.drawBox(10, 15, progress, 10);
} while ( u8g.nextPage() );
if (progress < 108) {
progress++;
} else {
progress = 0;
}
// delay(100);
}