Skip to content

Instantly share code, notes, and snippets.

View thankthemaker's full-sized avatar

ThankTheMaker thankthemaker

View GitHub Profile
/* ESP32 TWAI receive example.
Receive messages and sends them over serial.
Connect a CAN bus transceiver to the RX/TX pins.
For example: SN65HVD230
TWAI_MODE_LISTEN_ONLY is used so that the TWAI controller will not influence the bus.
The API gives other possible speeds and alerts:
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/twai.html
#include "driver/twai.h"
twai_message_t rx_frame = {};
gpio_num_t tx = GPIO_NUM_1;
gpio_num_t rx = GPIO_NUM_2;
void setup() {
delay(2000);
gpio_reset_pin(rx);
gpio_reset_pin(tx);
#include "Arduino.h"
#include <NimBLEDevice.h>
#include "esp_ota_ops.h"
#include <Preferences.h>
#include <ArduinoJson.h>
#define SOFTWARE_VERSION_MAJOR 1
#define SOFTWARE_VERSION_MINOR 0
#define SOFTWARE_VERSION_PATCH 0
#define HARDWARE_VERSION_MAJOR 3
@thankthemaker
thankthemaker / funwheel_light_control_v2.ino
Last active December 31, 2020 00:36
Funwheel Light Control
//#include "FastLED.h"
#include <Adafruit_NeoPixel.h>
#define PIN D1
#define PIN_FORWARD D2
#define PIN_BACKWARD D3
#define PIN_BRAKE D4
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 16
//#include "FastLED.h"
#include <Adafruit_NeoPixel.h>
#define PIN D1
#define TRIGGER D2
#define DIRECTION D3
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 16
#define MAX_BRIGHTNESS 25 // allowed values 1-255
#include <Adafruit_NeoPixel.h>
#define PIN D1
#define TRIGGER D2
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 16
int oldVal = LOW;
int newVal = LOW;
const byte led_gpio = 27; // the PWM pin the LED is attached to
const byte led_gpio2 = 26; // the PWM pin the LED is attached to
int MAX = 255;
int DELAY = 50;
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(115200);
ledcAttachPin(led_gpio, 0); // assign a led pins to a channel