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 "corgi85_blynk.h" | |
void CORGI85_BLINK::loop(void) | |
{ | |
switch (mode) | |
{ | |
case stop: |
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
#define sgn(x) ((x) < 0 ? -1 : ((x) > 0 ? 1 : 0)) | |
#define off 0 | |
#define on 1 | |
#include "Arduino.h" | |
#include <ESP32Encoder.h> //https://github.com/madhephaestus/ESP32Encoder | |
#include <math.h> |
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
// max velocity 1000 mm /s | |
// max acc 10 m /s^2 | |
#include "Arduino.h" | |
#include <ESP32Encoder.h> //https://github.com/madhephaestus/ESP32Encoder | |
#include <math.h> | |
hw_timer_t *timer = NULL; | |
hw_timer_t *timer1 = NULL; | |
portMUX_TYPE sync = portMUX_INITIALIZER_UNLOCKED; |
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
void recv() | |
{ | |
while (Serial3.available() > 0) | |
{ | |
for (byte index = 0; index < MAXLENGTH - 1; index++) | |
{ | |
receivedCommandStack[index] = receivedCommandStack[index + 1]; | |
} | |
receivedCommandStack[MAXLENGTH - 1] = Serial3.read(); |
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 <ESP32Encoder.h> // https://github.com/madhephaestus/ESP32Encoder | |
#include <math.h> | |
hw_timer_t *timer = NULL; | |
hw_timer_t *timer1 = NULL; | |
portMUX_TYPE sync = portMUX_INITIALIZER_UNLOCKED; | |
ESP32Encoder encoder; | |
const int encoderA_pin = 21; |
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
// wasin wongkum demo inverted pendulum on nano32(ESP32) | |
#include <ESP32Encoder.h> // https://github.com/madhephaestus/ESP32Encoder | |
#include <math.h> | |
hw_timer_t *timer = NULL; | |
hw_timer_t *timer1 = NULL; | |
portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED; | |
ESP32Encoder encoder; |
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 <ESP32Encoder.h> | |
hw_timer_t *timer = NULL; | |
portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED; | |
ESP32Encoder encoder; | |
const int encoderA_pin = 25; | |
const int encoderB_pin = 26; | |
const int encoder_CPR = 1600; |
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
uint8_t got_cmd = 0; | |
for (int tmp = 0; tmp < sizeof(command_tmp) - 7; tmp++) { | |
if (command_tmp[tmp] == 0xff && command_tmp[tmp + 1] == 0xfe) { | |
uint16_t sumcheck = 0; | |
uint16_t sumget = (uint16_t) command_tmp[tmp + 6] << 8 | (uint16_t) command_tmp[tmp + 7]; | |
for (int tmp_2 = 0; tmp_2 < 6; tmp_2++) { |
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
float f 1.23; | |
int val1 = f; | |
int val2 = (f * 10) % 10; | |
int val3 = (f * 100) % 10; | |
char buffer[20]; | |
sprintf(buffer, "val = %d.%d%d", val1, val2, val3); |
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 <SPI.h> | |
#include <SD.h> | |
#include <stdio.h> | |
#include <string.h> | |
const int chipSelect = PA4; | |
typedef struct data_log_typedef | |
{ |