Skip to content

Commit 2191740

Browse files
committed
update examples
1 parent 6af36d2 commit 2191740

34 files changed

+226
-105
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ jobs:
4949
run: pip install --upgrade platformio
5050
- name: Build PlatformIO examples
5151
run: |
52-
pio ci examples/${{ matrix.example }} \
53-
--lib=. \
54-
--project-conf=examples/${{ matrix.example }}/platformio.ini
52+
cd examples/${{ matrix.example }}
53+
pio run
5554
lint:
5655
name: "Lint"
5756
runs-on: ubuntu-22.04

examples/AdafruitPCA9685/AdafruitPCA9685.ino

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
// Using the namespace to have short class references (Animation and Servo)
1414
using namespace BlenderServoAnimation;
1515

16-
// Frames per second - see original Blender animation / ik.h
17-
#define FPS 30
18-
19-
// Total animation frames - see original Blender animation / ik.h
20-
#define FRAMES 100
21-
2216
// PWM driver instance to set PWM output
2317
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
2418

examples/AdafruitPCA9685/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Adafruit PCA9685
2+
3+
Using a PCA9685 PWM Servo Driver to animate 2 servos. The animation is based on the IK example of the Blender Servo Animation add-on which resembles a simple neck mechanism.
4+
5+
![test](../../images/arduino-nano-with-PCA9685.png)

examples/AdafruitPCA9685/ik.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,23 @@
66
Seconds: 3
77
Bones: 2
88
Armature: Armature
9+
Scene: Scene
910
File: ik.blend
1011
*/
1112

1213
#include <Arduino.h>
1314

15+
const byte FPS = 30;
16+
const int FRAMES = 100;
17+
1418
// Servo ID: 0
15-
const int NeckLeft[100] PROGMEM = {
19+
const int NeckLeft[FRAMES] PROGMEM = {
1620
375, 376, 377, 380, 384, 387, 391, 396, 400, 403, 406, 408, 410, 410, 409, 406, 402, 396, 390, 382, 373, 364, 355, 346, 338, 330, 323, 318, 314, 311, 309, 307, 305, 305, 305, 305, 306, 307, 309, 311, 314, 317, 320, 323, 327, 331, 335, 339, 343, 347,
1721
351, 356, 360, 364, 369, 374, 380, 386, 392, 398, 404, 410, 415, 420, 425, 429, 432, 435, 436, 437, 437, 436, 435, 434, 432, 430, 428, 426, 423, 421, 418, 415, 412, 409, 406, 403, 400, 397, 394, 391, 388, 386, 384, 381, 380, 378, 377, 376, 375, 375,
1822
};
1923

2024
// Servo ID: 1
21-
const int NeckRight[100] PROGMEM = {
25+
const int NeckRight[FRAMES] PROGMEM = {
2226
375, 376, 379, 383, 388, 394, 401, 409, 417, 426, 434, 443, 450, 457, 463, 468, 471, 472, 471, 469, 466, 462, 457, 452, 447, 441, 437, 432, 428, 424, 420, 416, 411, 407, 402, 398, 394, 389, 384, 380, 375, 370, 366, 361, 356, 352, 347, 342, 337, 333,
2327
328, 324, 319, 315, 312, 309, 308, 307, 306, 306, 306, 307, 308, 309, 310, 311, 312, 313, 313, 313, 313, 314, 315, 316, 318, 320, 322, 324, 327, 329, 332, 335, 338, 341, 344, 347, 350, 353, 356, 359, 362, 364, 366, 369, 370, 372, 373, 374, 375, 375,
2428
};

examples/AdafruitPCA9685/platformio.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
[platformio]
2+
src_dir = ./
3+
14
[env]
25
lib_deps =
36
adafruit/Adafruit PWM Servo Driver Library@^2.4.1
7+
BlenderServoAnimation=symlink://../../
48

59
[env:uno]
610
board = uno

examples/LiveMode/platformio.ini

Lines changed: 0 additions & 18 deletions
This file was deleted.

examples/MultiplePCA9685/MultiplePCA9685.ino

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
// Using the namespace to have short class references (Animation and Servo)
1414
using namespace BlenderServoAnimation;
1515

16-
// Frames per second - see original Blender animation / ik.h
17-
#define FPS 30
18-
19-
// Total animation frames - see original Blender animation / ik.h
20-
#define FRAMES 100
21-
2216
// PWM driver instances to set PWM output
2317
Adafruit_PWMServoDriver pwmA(0x40);
2418
Adafruit_PWMServoDriver pwmB(0x41);
@@ -36,12 +30,12 @@ struct servoMap {
3630
// Forward declare the callback as it will be referenced in the following array
3731
void setPWM(byte servoID, int position);
3832

39-
// Define an array of servo maps
33+
// Define an array of servo mapsf
4034
servoMap servoMaps[] = {
4135
// Servo attached to board A on channel 0
4236
{Servo(0, NeckLeft, setPWM), pwmA, 0},
4337

44-
// Servo attached to board A on channel 0
38+
// Servo attached to board B on channel 0
4539
{Servo(1, NeckRight, setPWM), pwmB, 0},
4640
};
4741

examples/MultiplePCA9685/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Multiple PCA9685
2+
3+
Using two PCA9685 PWM Servo Drivers to animate 2 servos. The animation is based on the IK example of the Blender Servo Animation add-on which resembles a simple neck mechanism.
4+
5+
Note that the A0 address jumper has to be soldered on the second driver board. This setup can easily be extended to animate up to 32 servos. If even more servos are needed, you can also add more driver boards to the chain.
6+
7+
![test](../../images/arduino-nano-with-2-PCA9685.png)

examples/MultiplePCA9685/ik.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,23 @@
66
Seconds: 3
77
Bones: 2
88
Armature: Armature
9+
Scene: Scene
910
File: ik.blend
1011
*/
1112

1213
#include <Arduino.h>
1314

15+
const byte FPS = 30;
16+
const int FRAMES = 100;
17+
1418
// Servo ID: 0
15-
const int NeckLeft[100] PROGMEM = {
19+
const int NeckLeft[FRAMES] PROGMEM = {
1620
375, 376, 377, 380, 384, 387, 391, 396, 400, 403, 406, 408, 410, 410, 409, 406, 402, 396, 390, 382, 373, 364, 355, 346, 338, 330, 323, 318, 314, 311, 309, 307, 305, 305, 305, 305, 306, 307, 309, 311, 314, 317, 320, 323, 327, 331, 335, 339, 343, 347,
1721
351, 356, 360, 364, 369, 374, 380, 386, 392, 398, 404, 410, 415, 420, 425, 429, 432, 435, 436, 437, 437, 436, 435, 434, 432, 430, 428, 426, 423, 421, 418, 415, 412, 409, 406, 403, 400, 397, 394, 391, 388, 386, 384, 381, 380, 378, 377, 376, 375, 375,
1822
};
1923

2024
// Servo ID: 1
21-
const int NeckRight[100] PROGMEM = {
25+
const int NeckRight[FRAMES] PROGMEM = {
2226
375, 376, 379, 383, 388, 394, 401, 409, 417, 426, 434, 443, 450, 457, 463, 468, 471, 472, 471, 469, 466, 462, 457, 452, 447, 441, 437, 432, 428, 424, 420, 416, 411, 407, 402, 398, 394, 389, 384, 380, 375, 370, 366, 361, 356, 352, 347, 342, 337, 333,
2327
328, 324, 319, 315, 312, 309, 308, 307, 306, 306, 306, 307, 308, 309, 310, 311, 312, 313, 313, 313, 313, 314, 315, 316, 318, 320, 322, 324, 327, 329, 332, 335, 338, 341, 344, 347, 350, 353, 356, 359, 362, 364, 366, 369, 370, 372, 373, 374, 375, 375,
2428
};

examples/MultiplePCA9685/platformio.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
[platformio]
2+
src_dir = ./
3+
14
[env]
25
lib_deps =
36
adafruit/Adafruit PWM Servo Driver Library@^2.4.1
7+
BlenderServoAnimation=symlink://../../
48

59
[env:uno]
610
board = uno

0 commit comments

Comments
 (0)