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
/* 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 |
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/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); |
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" | |
#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 |
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 "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 |
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 "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 |
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 <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; |
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
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 |