This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
// #define LGFX_USE_V1 | |
#include <LovyanGFX.hpp> | |
// This is the hardware: | |
// https://github.com/LilyGO/TTGO-TM-ESP32 | |
// LGFX for TTGO T-Display | |
class LGFX : public lgfx::LGFX_Device |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* simple poc demonstrating a timer interupt driven ISR living in a class */ | |
class foo { | |
public: | |
bool start_isr(); | |
private: | |
static void _timer_isr(); | |
hw_timer_t * exampleTimer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <tcpip_adapter.h> | |
static bool netif_isup() { | |
for (int i = TCPIP_ADAPTER_IF_STA; i < TCPIP_ADAPTER_IF_MAX; i++) | |
if (tcpip_adapter_is_netif_up((tcpip_adapter_if_t)i)) return true; | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <WiFi.h> | |
// https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system_time.html# | |
// https://github.com/espressif/esp-idf/blob/master/examples/protocols/sntp/main/sntp_example_main.c | |
const char* WIFI_NETWORK = "xxx"; | |
const char* WIFI_PASSWORD = "xxx"; | |
const char* NTP_POOL = "nl.pool.ntp.org"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server.on("/hw-reset", HTTP_GET, [](AsyncWebServerRequest *request){ | |
request->onDisconnect([](){ | |
#ifdef ESP32 | |
ESP.restart(); | |
#elif defined(ESP8266) | |
ESP.reset(); | |
#endif | |
}); | |
request->send(200, "text/plain","Restarting ..."); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is a serial to websocket server for application with a DSMR 5.x. conform 'Dutch Smart Meter'. | |
This sketch reads messages (terminated by a newline) from a smart meter connected on Serial | |
and echos these messages to clients connected on websocket '/ws'. | |
All non utf8 chararacters in the messages are dropped. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load Wi-Fi library | |
#include <WiFi.h> | |
// Replace with your network credentials | |
const char* ssid = ""; | |
const char* password = ""; | |
void setup(){ | |
IPAddress local_IP(192, 168, 0, 60); /* THIS SHOULD BE OUTSIDE YOUR ROUTERS DHCP RANGE! */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "driver/ledc.h" | |
static void enable_out_clock(uint8_t pin,double freq) { | |
periph_module_enable(PERIPH_LEDC_MODULE); | |
ledc_timer_bit_t bit_num = (ledc_timer_bit_t) 1; // 3 normally | |
int duty = pow(2, (int) bit_num) / 2; | |
ledc_timer_config_t timer_conf; | |
timer_conf.bit_num = bit_num; | |
timer_conf.freq_hz = freq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#define M5GO_WHEEL_ADDR 0x56 | |
#define MOTOR_CTRL_ADDR 0x00 | |
#define ENCODER_ADDR 0x04 | |
#define DEAD_ZONE 5 | |
void setMotor(int16_t pwm0, int16_t pwm1) { | |
Wire.beginTransmission(M5GO_WHEEL_ADDR); | |
Wire.write(MOTOR_CTRL_ADDR); // Motor ctrl reg addr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
void setup() { | |
// put your setup code here, to run once: | |
Wire.begin( 21, 22, 400000 ); | |
Wire.beginTransmission( 0X1A ); | |
uint8_t error = Wire.endTransmission(); | |
if ( error ) ESP_LOGI( TAG, "No codec found." ); | |
} |
NewerOlder