top of page
  • Writer's pictureNate Hopper

[ 12/12/22 - 12/16/22 ] Encoders are mean.

Updated: Dec 16, 2022

Okay, they're just encoders and they can't be mean, they're non-sentient machinery. However I still dislike them.


That's right, if the title didn't make it obvious, I'm back on the encoder grind this week, and it never gets easier! I decided that I couldn't just leave last week's code alone and that the robotic arm absolutely needed to use encoders and not just tick up a variable, so that's what I spent this week doing. So, I found an encoder library for arduino and got cracking and let me just say This was not worth it.

I don't make overly complicated code on purpose I swear.

You'll probably recognize this code, and if you do, good job and welcome back. If you don't, this is basically me rewiring the previous for loops I used last week to make this thing run. Don't worry, the keypad still functions the same for all you keypad fans out there, however the mechanisms in the code are completely different. Basically, I replaced the previousCount with the position variables from the encoder library that track encoder values, and based on the direction, have the motors go until newPosition and currentCount are equal, and then print the values.


"But Nate!" you might be saying, "Current Value and the Encoder Count aren't equal!" And to that I respond, "Yes, I know, this thing hates me." You see, for some reason, the encoder either skips numbers or operates out of pure spite, because the count is always 5-60 off of what it should be, which is not good in any sense. I don't know why it does this. I'll fix it next week.

8 views0 comments

Comments


bottom of page