speedometer-keren — ESP32 simulation

An interactive ESP32 circuit simulation you can run free in your browser on Velxio, by fisyamska.

Components

Sketch code

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#include <Adafruit_SSD1306.h>
#include <math.h>
#include "RTClib.h"
#include <Wire.h>
// #include <OneWire.h>
// #include <DallasTemperature.h>
#include "digital_740pt7b.h"
#include "digital_77pt7b.h"
#include "FreeSansBold12pt7b.h"
#include "FreeSansBold8pt7b.h" 
#include "digital_7__italic_13pt7b.h" 

RTC_DS3231 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

#define TFT_SCK  18
#define TFT_MOSI 23
#define TFT_MISO 19
#define TFT_DC    2
#define TFT_CS    15
#define TFT_RST   4

SPIClass tftSPI(VSPI);
Adafruit_ILI9341 tft = Adafruit_ILI9341(&tftSPI, TFT_DC, TFT_CS, TFT_RST);


#define I2C_SDA_2 32
#define I2C_SCL_2 33

TwoWire I2C_Kedua = TwoWire(1);

#define SCREEN_WIDTH 128
#define SCREEN_HIGHT 64
#define OLED_RESET   -1

Adafruit_SSD1306 oled1(SCREEN_WIDTH,SCREEN_HIGHT,&Wire,OLED_RESET);

Adafruit_SSD1306 oled2(SCREEN_WIDTH,SCREEN_HIGHT,&I2C_Kedua,OLED_RESET);


#define WARNA_BENSIN_PENUH   0x07E0 // Hijau
#define WARNA_BENSIN_SEDANG  0xFFE0 // Kuning
#define WARNA_BENSIN_KRITIS  0xF800 // Merah
#define WARNA_BAR_KOSONG     0x2104 // Abu-abu gelap / Biru sangat gelap (sesuaikan dengan BG Anda)

/*/====== vaiabel sensor DS18B20====//
const int oneWireBus = 26;     

OneWire oneWire(oneWireBus);

DallasTemperature sensors(&oneWire);
*/

// --- Bitmap Ikon temp ---
const unsigned char PROGMEM suhuIcon[] = {
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 
	0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0xf0, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x01, 0x80, 0x00, 
	0x00, 0x01, 0xf0, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x01, 0xf0, 0x00, 
	0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x03, 0x83, 0xc1, 0xc0, 
	0x07, 0xf3, 0xcf, 0xf0, 0x0c, 0x73, 0xce, 0x30, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x01, 0xce, 0x73, 0x80, 0x03, 0x7b, 0xde, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

// --- Bitmap Ikon Bensin ---
const unsigned char PROGMEM gasIcon[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xe3, 0x00, 
	0x07, 0xff, 0xe3, 0x80, 0x07, 0xff, 0xf0, 0xe0, 0x0f, 0x00, 0x70, 0x70, 0x0e, 0x00, 0x70, 0x38, 
	0x0e, 0x00, 0x70, 0x38, 0x0e, 0x00, 0x70, 0x38, 0x0e, 0x00, 0x70, 0x38, 0x0e, 0x00, 0x70, 0x08, 
	0x0f, 0xff, 0xfc, 0x08, 0x0f, 0xff, 0xfe, 0x08, 0x0f, 0xff, 0xf3, 0x08, 0x0f, 0xff, 0xf3, 0x08, 
	0x0f, 0xff, 0xf3, 0x08, 0x0f, 0xff, 0xf3, 0x08, 0x0f, 0xff, 0xf3, 0x08, 0x0f, 0xff, 0xf3, 0x08, 
	0x0f, 0xff, 0xf3, 0x18, 0x0f, 0xff, 0xf3, 0x98, 0x0f, 0xff, 0xf1, 0xf0, 0x0f, 0xff, 0xf0, 0xe0, 
	0x0f, 0xff, 0xf0, 0x00, 0x0f, 0xff, 0xf0, 0x00, 0x0f, 0xff, 0xf8, 0x00, 0x1f, 0xff,

More projects by fisyamska