-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce scene based library approach
- Loading branch information
1 parent
9052a49
commit 4076e09
Showing
69 changed files
with
2,113 additions
and
2,222 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"files.associations": { | ||
"*.tcc": "cpp", | ||
"exception": "cpp", | ||
"memory_resource": "cpp", | ||
"iosfwd": "cpp", | ||
"new": "cpp", | ||
"ostream": "cpp", | ||
"sstream": "cpp", | ||
"stop_token": "cpp", | ||
"streambuf": "cpp", | ||
"__bit_reference": "cpp", | ||
"__string": "cpp", | ||
"algorithm": "cpp", | ||
"deque": "cpp", | ||
"ios": "cpp", | ||
"string": "cpp", | ||
"type_traits": "cpp", | ||
"cstddef": "cpp", | ||
"array": "cpp", | ||
"bitset": "cpp", | ||
"vector": "cpp", | ||
"string_view": "cpp", | ||
"functional": "cpp", | ||
"iomanip": "cpp", | ||
"istream": "cpp", | ||
"limits": "cpp", | ||
"ratio": "cpp", | ||
"tuple": "cpp", | ||
"__config": "cpp", | ||
"__hash_table": "cpp", | ||
"__locale": "cpp", | ||
"iterator": "cpp", | ||
"locale": "cpp", | ||
"thread": "cpp" | ||
} | ||
} |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
Setting up a show consisting of 2 animations. | ||
|
||
Note the namespaces which are used to distinguish the positions | ||
of one scene / animation from another. It's even possible to | ||
have different playback rates (fps) and frames per animation. | ||
*/ | ||
|
||
#include "scene-a.h" | ||
#include "scene-b.h" | ||
#include <BlenderServoAnimation.h> | ||
|
||
#ifdef ARDUINO_ARCH_ESP32 | ||
#include <ESP32Servo.h> | ||
#else | ||
#include <Servo.h> | ||
#endif | ||
|
||
// Servo object to send positions | ||
Servo myServo; | ||
|
||
// Callback function which is called whenever a servo needs to be moved | ||
void move(byte servoID, int position) { | ||
// Ignore the servoID (there is only one servo) and write the current position | ||
myServo.writeMicroseconds(position); | ||
} | ||
|
||
// Animation object to represent the original Blender animation | ||
BlenderServoAnimation::Animation animation; | ||
|
||
void setup() { | ||
// Attach the servo to pin 12 | ||
myServo.attach(12); | ||
|
||
// Set the position callback | ||
animation.onPositionChange(move); | ||
|
||
// Add multiple scenes based on PROGMEM data | ||
animation.addScene(SceneA::ANIMATION_DATA, SceneA::LENGTH, SceneA::FPS, SceneA::FRAMES); | ||
animation.addScene(SceneB::ANIMATION_DATA, SceneB::LENGTH, SceneB::FPS, SceneB::FRAMES); | ||
|
||
// Trigger the show loop mode | ||
animation.loop(); | ||
|
||
// There are also other playback options | ||
// show.play(); // Plays all scenes once in the order they have been added | ||
// show.playRandom(); // Randomly plays scenes in a loop | ||
// show.playSingle(1); // Play the scene at the given index once | ||
} | ||
|
||
void loop() { | ||
// Update the animation state on each loop | ||
animation.run(); | ||
} |
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
Blender Servo Animation Positions | ||
|
||
FPS: 30 | ||
Frames: 100 | ||
Seconds: 3 | ||
Bones: 1 | ||
Armature: Armature | ||
Scene: SceneA | ||
File: scenes.blend | ||
*/ | ||
|
||
#include <Arduino.h> | ||
|
||
namespace SceneA { | ||
|
||
const byte FPS = 30; | ||
const int FRAMES = 100; | ||
const int LENGTH = 600; | ||
|
||
const byte PROGMEM ANIMATION_DATA[LENGTH] = { | ||
60, 0, 5, 192, 62, 10, 60, 0, 5, 193, 62, 10, 60, 0, 5, 197, 62, 10, 60, 0, 5, 203, 62, 10, 60, 0, 5, 212, 62, 10, 60, 0, 5, 222, 62, 10, 60, 0, 5, 235, 62, 10, 60, 0, 5, 249, 62, 10, 60, 0, | ||
6, 8, 62, 10, 60, 0, 6, 26, 62, 10, 60, 0, 6, 44, 62, 10, 60, 0, 6, 63, 62, 10, 60, 0, 6, 83, 62, 10, 60, 0, 6, 104, 62, 10, 60, 0, 6, 125, 62, 10, 60, 0, 6, 146, 62, 10, 60, 0, 6, 168, | ||
62, 10, 60, 0, 6, 190, 62, 10, 60, 0, 6, 211, 62, 10, 60, 0, 6, 232, 62, 10, 60, 0, 6, 253, 62, 10, 60, 0, 7, 17, 62, 10, 60, 0, 7, 36, 62, 10, 60, 0, 7, 54, 62, 10, 60, 0, 7, 72, 62, 10, | ||
60, 0, 7, 87, 62, 10, 60, 0, 7, 101, 62, 10, 60, 0, 7, 114, 62, 10, 60, 0, 7, 124, 62, 10, 60, 0, 7, 133, 62, 10, 60, 0, 7, 139, 62, 10, 60, 0, 7, 143, 62, 10, 60, 0, 7, 144, 62, 10, 60, 0, | ||
7, 142, 62, 10, 60, 0, 7, 134, 62, 10, 60, 0, 7, 122, 62, 10, 60, 0, 7, 106, 62, 10, 60, 0, 7, 87, 62, 10, 60, 0, 7, 63, 62, 10, 60, 0, 7, 36, 62, 10, 60, 0, 7, 7, 62, 10, 60, 0, 6, 231, | ||
62, 10, 60, 0, 6, 196, 62, 10, 60, 0, 6, 159, 62, 10, 60, 0, 6, 121, 62, 10, 60, 0, 6, 81, 62, 10, 60, 0, 6, 41, 62, 10, 60, 0, 5, 255, 62, 10, 60, 0, 5, 213, 62, 10, 60, 0, 5, 171, 62, 10, | ||
60, 0, 5, 129, 62, 10, 60, 0, 5, 87, 62, 10, 60, 0, 5, 47, 62, 10, 60, 0, 5, 7, 62, 10, 60, 0, 4, 225, 62, 10, 60, 0, 4, 188, 62, 10, 60, 0, 4, 153, 62, 10, 60, 0, 4, 121, 62, 10, 60, 0, | ||
4, 92, 62, 10, 60, 0, 4, 65, 62, 10, 60, 0, 4, 41, 62, 10, 60, 0, 4, 22, 62, 10, 60, 0, 4, 6, 62, 10, 60, 0, 3, 250, 62, 10, 60, 0, 3, 242, 62, 10, 60, 0, 3, 240, 62, 10, 60, 0, 3, 241, | ||
62, 10, 60, 0, 3, 245, 62, 10, 60, 0, 3, 250, 62, 10, 60, 0, 4, 2, 62, 10, 60, 0, 4, 11, 62, 10, 60, 0, 4, 22, 62, 10, 60, 0, 4, 35, 62, 10, 60, 0, 4, 49, 62, 10, 60, 0, 4, 64, 62, 10, | ||
60, 0, 4, 81, 62, 10, 60, 0, 4, 98, 62, 10, 60, 0, 4, 117, 62, 10, 60, 0, 4, 136, 62, 10, 60, 0, 4, 155, 62, 10, 60, 0, 4, 175, 62, 10, 60, 0, 4, 196, 62, 10, 60, 0, 4, 216, 62, 10, 60, 0, | ||
4, 236, 62, 10, 60, 0, 5, 1, 62, 10, 60, 0, 5, 21, 62, 10, 60, 0, 5, 40, 62, 10, 60, 0, 5, 59, 62, 10, 60, 0, 5, 78, 62, 10, 60, 0, 5, 95, 62, 10, 60, 0, 5, 112, 62, 10, 60, 0, 5, 127, | ||
62, 10, 60, 0, 5, 141, 62, 10, 60, 0, 5, 154, 62, 10, 60, 0, 5, 165, 62, 10, 60, 0, 5, 174, 62, 10, 60, 0, 5, 182, 62, 10, 60, 0, 5, 187, 62, 10, 60, 0, 5, 191, 62, 10, 60, 0, 5, 192, 62, 10, | ||
}; | ||
|
||
} // namespace SceneA |
Oops, something went wrong.