misan / dcservo

Position control of DC motors
315 stars 115 forks source link

Direction in ATTiny85 #84

Closed alifilhan0 closed 1 year ago

alifilhan0 commented 1 year ago

Present code in attiny85.ino looks like the direction isn't supported. Is it a problem here? Also the pro micro code looks small enough 6.8 KiB. Can it be/I try porting it? Also why exactly is the direction isn't supported in tiny85? It does say "let's count steps, we'll care about direction later"

misan commented 1 year ago

Direction pin is pin 5 in the tiny85 code: https://github.com/misan/dcservo/blob/master/attiny85.ino#L15

I guess what is confusing is the pin assignment is different if DEBUG is defined

alifilhan0 commented 1 year ago

Thanks a lot for quick response. But what is this? https://github.com/misan/dcservo/blob/f771ad9d3e37a16a04d61cf8a9b92b1b7620c768/attiny85.ino#L163

misan commented 1 year ago

Step is detected first, then, depending on the direction input, the target value is increased by -1 or +1 https://github.com/misan/dcservo/blob/f771ad9d3e37a16a04d61cf8a9b92b1b7620c768/attiny85.ino#L177

alifilhan0 commented 1 year ago

Thanks a lot!