D21G Interruption in only one channel

This post refers to

https://industruino.com/forum/help-1/question/d21g-interruption-in-only-one-channel-ex-ch1-609

Am a bit of a newbie at this stuff but I have the exact opposite problem.  When I run the test code in the example above, it works as it is (ie I have only one channel set as an input.)  If I enable more than one channel as an input then neither channels trigger the interrupt.

I am running a D21G top board and have the latest libraries installed.

Am I missing something?

Ray Grove
Ray Grove
24
| 3 1 2
Asked on 1/8/19, 12:04 PM
0
vote
2149 Views

Hi, can you use the example sketch as here https://github.com/Industruino/libraries/blob/master/README.md#interrupts

and then instead of just using CH1, also use CH2-3-4 by including these lines:

  Indio.digitalMode(1, OUTPUT); //  Clear CH1 to LOW
  Indio.digitalWrite(1, LOW);  // Clear CH1 to LOW
  Indio.digitalMode(1, INPUT); // Set CH1 as an input with interrupt

  Indio.digitalMode(2, OUTPUT); //  Clear CH2 to LOW
  Indio.digitalWrite(2, LOW);  // Clear CH2 to LOW
  Indio.digitalMode(2, INPUT_MASKED); // Set CH2 as an input without interrupt

  Indio.digitalMode(3, OUTPUT); //  Clear CH3 to LOW
  Indio.digitalWrite(3, LOW);  // Clear CH3 to LOW
  Indio.digitalMode(3, INPUT); // Set CH3 as an input with interrupt

  Indio.digitalMode(4, OUTPUT); //  Clear CH4 to LOW
  Indio.digitalWrite(4, LOW);  // Clear CH4 to LOW
  Indio.digitalMode(4, INPUT_MASKED); // Set CH4 as an input without interrupt

Leave the rest unchanged, then this should trigger the interrupt and counter on CH1 and Ch3, while CH2 and CH4 are inputs without interrupt.

Tom
Tom
5675
| 1 1 3
Answered on 1/9/19, 12:18 AM
1
vote

Apologies for the delay in coming back.  Yes, the code works.  I used the example you mentioned but didn't use the INPUT_MASKED bit so I am thinking that not doing this caused my problem.
 

Ray Grove
Ray Grove
24
| 3 1 2
Answered on 1/24/19, 8:38 AM
0
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

54 follower(s)

Stats

Asked: 1/8/19, 12:04 PM
Seen: 2149 times
Last updated: 1/24/19, 8:38 AM