Skip to content

Commit 0eaf567

Browse files
Examples
Example for rotation by euler angles Fixed Stepper example
1 parent 83527d6 commit 0eaf567

File tree

5 files changed

+293
-78
lines changed

5 files changed

+293
-78
lines changed

RoboHeart.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ bool RoboHeart::begin() {
105105
return true;
106106
}
107107

108+
109+
void RoboHeart::setPWM(int motor, int freq, int pwm){
110+
if(motor == MOTOR_A){
111+
motorA.configPWM(freq, pwm);
112+
} else if (motor == MOTOR_B){
113+
motorB.configPWM(freq, pwm);
114+
} else if (motor == MOTOR_C){
115+
motorC.configPWM(freq, pwm);
116+
}
117+
}
118+
108119
void RoboHeart::setAutomaticRotation(){
109120

110121
Serial.println("Automatic calibration started.");

RoboHeart.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
#define MOTOR_C_CHANNEL1 4
2929
#define MOTOR_C_CHANNEL2 5
3030

31+
#define MOTOR_A 0
32+
#define MOTOR_B 1
33+
#define MOTOR_C 2
34+
3135
#define LSM6DS3_I2C_ADDR 0x6A // or 0x6B - Address is defined in Library
3236

3337
typedef struct {
@@ -69,6 +73,7 @@ class RoboHeart {
6973
static void rotationCallBack(void *pvParameter);
7074
float getTemperatureC();
7175
float getTemperatureF();
76+
void setPWM(int motor, int freq, int pwm);
7277

7378
private:
7479
Stream* _debug = NULL;

0 commit comments

Comments
 (0)