Grid[Join[{{"Divisions","Steps per division"}},Table[{d,512/d},{d,Divisors[512]}]],Frame->True,Background->{None,{LightGray,{White,LightBlue}}}]

steps = 8;

f=Sequence[v>3, steps]

r= Sequence[v<1, -steps]

sys=NonlinearStateSpaceModel[{{},With[{f=f,r=r},Which[f,r ,True, 0]]},{},{{v,2.5}},SamplingPeriod->0.1]

ic={"4"->"Analog"};

i="stepper28BYJ48ATtiny85.h";
u={"uint8_t pins[4] = {0, 1, 2, 3}","StepperMotor m(pins)"};
l={"int val","m.rotate(val)"};

oc=<|"Type"->"ExternalLibrary","IncludeFiles"-> i,"Utilities"-> u,"Loop"->l|>;

μc=<|"Target"->"AdafruitTrinket5V","Inputs"->ic,"Outputs"->oc|>

p=\[LeftAssociation]"ExternalProgrammer"->"usbtiny"\[RightAssociation];

lib=FileNameJoin[{Nest[ParentDirectory,NotebookDirectory[],3],"Resources","stepper28BYJ48ATtiny85"}];

Needs["MicrocontrollerKit`"]

MicrocontrollerEmbedCode[sys,μc,p,<|"Libraries"->lib|>]