diff options
| author | schererleander <leander@schererleander.de> | 2025-12-25 18:09:23 +0100 |
|---|---|---|
| committer | schererleander <leander@schererleander.de> | 2025-12-25 18:09:23 +0100 |
| commit | d7edbf05ab0e90eedcb99e4462e3a61793b2eff9 (patch) | |
| tree | c30d7b7c73f421cf7b722ddfc9c4db3962c30b63 /src/blog/3dprint.md | |
| parent | a3c2943ebf15890f01634d030e59b7d7fcc9bf1f (diff) | |
remove all files
Diffstat (limited to 'src/blog/3dprint.md')
| -rw-r--r-- | src/blog/3dprint.md | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/src/blog/3dprint.md b/src/blog/3dprint.md deleted file mode 100644 index 3a65f02..0000000 --- a/src/blog/3dprint.md +++ /dev/null @@ -1,66 +0,0 @@ ---- -title: "3D Printing" -date: "2025-06-25" -excerpt: "My 3D-printing projects: from a robotic arm to a DIY drone." -cover: "/images/a1.webp" ---- - -# Projects - -## Robotic Arm - -3D model on [MakerWorld](https://makerworld.com/en/models/528885-robotic-arm#profileId-445995) – modified to work with my servo motors. - -```cpp -#include <Bluepad32.h> -#include <ESP32Servo.h> - -#define DEADZONE 30 -#define BASE_PIN 15 -#define SHOULDER_PIN 2 -#define ELBOW_PIN 4 -#define WRIST_PIN 16 -#define HAND_PIN 17 - -Servo base, shoulder, elbow, wrist, hand; -ControllerPtr pad; - -void onConnectedGamepad(ControllerPtr ctl) { - Serial.printf("Gamepad #%d connected\n", ctl->index()); - pad = ctl; -} - -void onDisconnectedGamepad(ControllerPtr ctl) { - Serial.printf("Gamepad disconnected\n"); -} - -int16_t mapAxis(int16_t v) { - if (abs(v) < DEADZONE) v = 0; - return map(v, -512, 512, 0, 180); -} - -void setup() { - BP32.setup(&onConnectedGamepad, &onDisconnectedGamepad); - BP32.enableNewBluetoothConnections(true); - - base.attach(BASE_PIN); - shoulder.attach(SHOULDER_PIN); - elbow.attach(ELBOW_PIN); - wrist.attach(WRIST_PIN); - hand.attach(HAND_PIN); -} - -void loop() { - BP32.update(); - if (pad && pad->isConnected()) { - base.write(mapAxis(pad->axisX())); - shoulder.write(mapAxis(-pad->axisY())); - elbow.write(mapAxis(-pad->axisRY())); - hand.write(mapAxis(pad->throttle() - pad->brake())); - - if (pad->l1()) wrist.write(0); - else if (pad->r1()) wrist.write(180); - else wrist.write(90); - } - delay(15); -} |
