Skip to content

Instantly share code, notes, and snippets.

@kvasdopil
Last active November 20, 2023 16:51
Show Gist options
  • Save kvasdopil/57274f8a06803eacd1a147182b637544 to your computer and use it in GitHub Desktop.
Save kvasdopil/57274f8a06803eacd1a147182b637544 to your computer and use it in GitHub Desktop.
servo pid control for robot claw
console.log(123);
let i = 0;
/*setInterval(() => {
analogWrite(D2, i, {freq: 50});
console.log(i);
i+=0.1;
if (i > 1) i = 0;
}, 500);*/
const min = 0.02;
const max = 0.125;
const set = n => analogWrite(D2, n/1000, {freq: 50});
const open = () => set(20);
const close = () => set(125);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment