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1
};
void loop() {
if(micros() - origtime >= period) {
difftime = micros() - origtime;
digitalWrite(PIN_CRANK, crank[tooth]);
digitalWrite(PIN_CAM, cam[tooth]);
if(tooth != 239){
tooth += 1;
} else if (tooth == 239){
tooth = 0;
}
origtime = micros();
}
}