• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

Events triggered on a counter

I have a small ISR with an if statement.  I have a 360 slot trigger wheel and what im trying to do is create an if statement that will only equate true on every 8th tooth.  The idea is to make it into a 45 tooth wheel, buy only executing on every 8th.  My problem is that I'm not sure how the statement should look.

something like this maybe..........
 
if(counter % 8)
{
do some stuff
}

Open in new window

0
SeanKeys
Asked:
SeanKeys
  • 2
1 Solution
 
sunnycoderCommented:
Hello SeanKeys,

if ( counter % 8 == 0 )
{
   //do stuff
}

Regards,

sunnycoder
0
 
SeanKeysAuthor Commented:
couldn't I also do

if (!(counter % 8))



?
0
 
sunnycoderCommented:
Yes ... that would work too
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now