mirror of
https://gitlab.waag.org/make/fablab/interns/2025/sam.git
synced 2025-08-03 11:54:58 +00:00
first steps for drone firmware
This commit is contained in:
9
src/drone/conf.h
Normal file
9
src/drone/conf.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#define MOTOR1 D0
|
||||||
|
#define MOTOR2 D1
|
||||||
|
#define MOTOR3 D2
|
||||||
|
#define MOTOR4 D3
|
||||||
|
#define PWMFREQ 50 //every 20ms
|
||||||
|
#define PWMRESOLUTION 16
|
||||||
|
#define BNOINTERRUPTSIG D6
|
||||||
|
#define BNOI2CADRESS 0x4b
|
||||||
|
//https://docs.arduino.cc/language-reference/en/structure/further-syntax/define/
|
@@ -1,4 +1,4 @@
|
|||||||
#include <FastLED.h>
|
#include "conf.h"
|
||||||
#include <Adafruit_BNO08x.h>
|
#include <Adafruit_BNO08x.h>
|
||||||
#include <sh2.h>
|
#include <sh2.h>
|
||||||
#include <sh2_SensorValue.h>
|
#include <sh2_SensorValue.h>
|
||||||
@@ -8,7 +8,11 @@
|
|||||||
#include <shtp.h>
|
#include <shtp.h>
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// put your setup code here, to run once:
|
// Setup all ESC
|
||||||
|
ledcAttach(MOTOR1, PWMFREQ, PWMRESOLUTION);
|
||||||
|
ledcAttach(MOTOR2, PWMFREQ, PWMRESOLUTION);
|
||||||
|
ledcAttach(MOTOR3, PWMFREQ, PWMRESOLUTION);
|
||||||
|
ledcAttach(MOTOR4, PWMFREQ, PWMRESOLUTION);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,3 +20,13 @@ void loop() {
|
|||||||
// put your main code here, to run repeatedly:
|
// put your main code here, to run repeatedly:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void calibrateESC() {
|
||||||
|
ledcWrite(MOTOR1, 1100);
|
||||||
|
ledcWrite(MOTOR2, 1100);
|
||||||
|
ledcWrite(MOTOR3, 1100);
|
||||||
|
ledcWrite(MOTOR4, 1100);
|
||||||
|
}
|
||||||
|
|
||||||
|
//https://randomnerdtutorials.com/esp32-pwm-arduino-ide/
|
Reference in New Issue
Block a user