0

Neotrellis interrupt wire
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Neotrellis interrupt wire

by Moris526 on Thu Apr 15, 2021 5:27 pm

Hi.

Im using Raspberry to contro Neotrellis led/Button board.

Im trying to read the interupt wire on the neotrellis board with this code:



Code: Select all | TOGGLE FULL SIZE
import RPi.GPIO as GPIO         
 
GPIO.setmode(GPIO.BCM)         
INPUT_PIN = 4         
GPIO.setup(INPUT_PIN, GPIO.IN)         


while True:
           if (GPIO.input(INPUT_PIN) == True):
                    print('1')
           else:
                    print('0')





But I get a stream of ones from the beginning, and nothing changes when I press a button.

Any idea? Not a programmer, as you can see.

Moris526
 
Posts: 81
Joined: Fri Jan 17, 2020 10:09 am

Re: Neotrellis interrupt wire

by dastels on Thu Apr 15, 2021 7:42 pm

Firstly, INT is active low (there's a pullup on the Neotrellis board) so you will want to watch for a low.

Style nitpick: comparing with True is redundant and probably wastes time and memory (though the byte compiler may optimize that away).

Finally, the interrupt feature has to be enabled. See keypad.py (~ line 76) https://github.com/adafruit/Adafruit_CircuitPython_seesaw/blob/9e06ac00fb27817b031b6b5acadd9542cab2989f/adafruit_seesaw/keypad.py#L76.

It looks like you're using plain cpython? You might consider using Blinka to give access to the CircuitPythion modules (notably adafruit_neotrellis). See https://learn.adafruit.com/circuitpython-on-raspberrypi-linux for more information.

Dave

dastels
 
Posts: 6440
Joined: Tue Oct 20, 2015 3:22 pm

Re: Neotrellis interrupt wire

by Moris526 on Sun Apr 25, 2021 11:28 am

Thanks for the answer.

I am using blinka

I can make it work with a button

Here is my current code

Code: Select all | TOGGLE FULL SIZE
from board import SCL, SDA
import busio
from adafruit_neotrellis.noetrellis import NeoTrellis
from adafruit_neotrellis.multitrellis import MultiTrellis

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)

INPUT_PIN = 21

GPIO.setup( INPUT_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)

While (True):
   
      if (GPIO.input (INPUT_PIN)  == False):

              print ('1')
      else:

              print(´'0')


2 Questions:

1 - Does the interrupt indicates the board it comes from when theres is more than one?

2- Can you tell me how to enable the interrupt?

Moris526
 
Posts: 81
Joined: Fri Jan 17, 2020 10:09 am

Re: Neotrellis interrupt wire

by Moris526 on Thu May 06, 2021 7:00 pm

Please ??

Moris526
 
Posts: 81
Joined: Fri Jan 17, 2020 10:09 am

Re: Neotrellis interrupt wire

by Moris526 on Sat May 15, 2021 8:28 pm

Pretty pleasseee

Moris526
 
Posts: 81
Joined: Fri Jan 17, 2020 10:09 am

Please be positive and constructive with your questions and comments.