lundi 6 novembre 2017

C#, counter reset when a condition becomes true

I have 2 counters called a1count and b1count. The part of the code is used to control a stepper motor. Whenever the motor driver returns a 1, it means that a rotation cycle is complete and a1count is incremented. During the cycle, if for some reason the motor could not complete the spin(fail condition), the driver returns a 0, and b1count is incremented.

Now Im trying to create a consecutive fail condition count called c1count which will pop-up a messagebox if say suppose b1count reaches 10. If c1count <= 10 then a messagebox pops up notifying the error. However, if in between those 10 counts, a1count is incremented then I want to reset c1count to 0, ans start counting to 10 again if b1count reaches 10 consecutively without a1count increment.

Please help!!

Aucun commentaire:

Enregistrer un commentaire