Python Forum
Stop/continue While loop block - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Stop/continue While loop block (/thread-31764.html)

Pages: 1 2 3 4 5 6 7


RE: Stop/continue While loop block - bowlofred - Jan-04-2021

interrupt_enabled isn't a method, so you don't call it (you don't use parentheses).

Try instead:

while True:
 
     if trellis.interrupt_enabled == True:
 
        print("test")
 
     else:
        trellis.sync()
        time.sleep(0.02)



RE: Stop/continue While loop block - Larz60+ - Jan-04-2021

bowlofred is correct, but if you are truly using interrupts, you shouldn't need (nor want) any sleep time.

I'm intrigued by this device and have ordered one. If you haven't figured it out by the time I receive one, I'll let you know how to make it work.


RE: Stop/continue While loop block - Moris526 - Jan-04-2021

Here is a tribe of Neotrellis builders

https://llllllll.co/t/diy-monome-compatible-grid-w-adafruit-neotrellis/28106


RE: Stop/continue While loop block - Moris526 - Jan-04-2021

I try:

while True:
  
     if trellis.interrupt_enabled == True:
  
        print("test")
  
     else:
        trellis.sync()
        time.sleep(0.02)
Now I get no error. But not interrupt detected.

In the Adafruits page says that the GPIO pin is #5 by default https://learn.adafruit.com/adafruit-neotrellis/circuitpython-code

But shouldnt be there be indicated somewhere in the code? I cant find it.

Quote:If you haven't figured it out by the time I receive one, I'll let you know how to make it work.

Dance


RE: Stop/continue While loop block - Moris526 - Jan-04-2021

In my proyect I want to send data from Pc ( Max/MSP ) to Rasp to Neotrellis Board

If I get something like this

https://www.ebay.com/itm/USB-to-I2C-Module-FT200XD-Full-Speed-Bridge-L4X3-TTL-Input-CMOS-Output-CJMCU-200/193700495898?_trkparms=ispr%3D1&hash=item2d1973021a:g:e1AAAOSwq5FffaMf&amdata=enc%3AAQAFAAACcBaobrjLl8XobRIiIML1V4Imu%252Fn%252BzU5L90Z278x5ickkfKe2vUidqHRg3XM2X2xOVD%252BjXfwMdVWozTPOqvYMw9%252FfCRgNlZkPbNrPwBQy6IY3EfkrliUc0VXgbuhjUCj81zZUkC%252FKkNCKVzzK7NoicUh5JpWYd3dMgEPJUPzyH5veenLFOuOJgHOVlAuuuwFw9wWpMaPYzHzyruVDcRQgqe%252FMzpMCq%252F7sKB6pbDW01l1jNMhztV5MiTFkmRHUZqFBQlTbtHLE5Xd1fPr2oXPvbmZbmrkEuts5ihpBfiZ5cKSKzGpIVB0QoqDM6qEBqUmI%252FHcmm3OOb0f%252Fv29bTxuPWWLQEpSRcFcmjKC%252Fv1XQvcYGXCHIkSoL7FNm2%252FiZ4QqorkNKnLckED5ANdhHSw6XzG1SZ20LxKqlNmQtCAh3rz%252BXO3awNkl%252FswXXUfowbtmi8%252BGUOOSiB0u3SnulDfokazs9sNt0FaHSu2S5wCqERAeOWtwaecstyal8cpmeGPFoDZEzCR0nQSJbvy%252BR0XAykIQtMSAU08UqcB0kgTcUWtdIkN9tU8XYgwT826bhBNjh8WeFzEWF7CmByQSybR4fjS3JqyQCU1b%252BSfVpACXg6QnYq0Vj4ZDQuJm21wy3LNlMtzmORFqD7VEn2hMSgt6HbylrdoGQx9sm4siLol7%252FaFpB76Aii73xL1mLgkFxdeOnYvPeExOwY8DBfEeTaHZTbGfdMhIr%252FjYCWnkUtIVKJ%252BFF0N1TZgdo%252BMjhSvVR9COXO2pd3SRggA0ma8WC82nKqj3MvT35BQvgFoiMTPo32bEe3WBdsi861HL2K1byGmkSGQ%253D%253D%7Ccksum%3A1937004958985740d37b262d4897a61140875c59aedc%7Campid%3APL_CLK%7Cclp%3A2334524

Wouldnt it be better?


RE: Stop/continue While loop block - Larz60+ - Jan-04-2021

Quote:If I get something like this

https://www.ebay.com/itm/USB-to-I2C-Modu...%3A2334524

Wouldn't it be better?

I think Yes. Good tool to have available at any rate, since price is so low.

Quote:No. This one.

https://learn.adafruit.com/adafruit-neotrellis?view=all

Is there anything else I will need?

if so, a Bill Of Materials would be nice to have.


RE: Stop/continue While loop block - Moris526 - Jan-05-2021

(Jan-04-2021, 10:05 AM)Larz60+ Wrote: Is there anything else I will need?

They sell you a case if you want.

And this cables are handy if you dont want to solder

https://www.adafruit.com/product/3568

https://www.adafruit.com/product/4045

For interrupt you have to solder a pin on the side.

They have a sample code both for Arduino and Rasp.

I think thats it.

If you want to build a more than one unit board, in the monome page theres is a video on how to do it with headers.


RE: Stop/continue While loop block - Larz60+ - Jan-05-2021

Should have by Friday.

I also purchased Adafruit MCP2221A Breakout - General Purpose USB to GPIO ADC I2C board to convert i2c to USB-A
and (don't know if needed, but just in case) STEMMA QT / Qwiic JST SH 4-pin Cable which looks like it might be a different cable that the one ordered previously.

There's a video on how to use the converter (actually for a different project) here: https://www.youtube.com/watch?v=afOqJdf2MlU&feature=emb_logo


RE: Stop/continue While loop block - Moris526 - Jan-06-2021

Quote:Should have by Friday.
Dance


Quote:There's a video on how to use the converter (actually for a different project) here: https://www.youtube.com/watch?v=afOqJdf2MlU&feature=emb_logo

Intresting

Check out the last post on this Adafruit thread about interrupt with Python

https://forums.adafruit.com/viewtopic.php?f=50&t=173615


RE: Stop/continue While loop block - Larz60+ - Jan-06-2021

Documents for MCP2221A:
The writeup on the Neotrellis board here: https://learn.adafruit.com/adafruit-neotrellis?view=all
states: These 4x4 button pad boards are fully tile-able and communicate over I2C. With 5 address pins, you've got the ability to connect up to 32 together in any arrangement you like. With our trusty seesaw I2C-to-anything chip, you don't even need to manage the NeoPixel driving. That's right! Both the button management and LED driving is completely handled for you all over plain I2C. With both Arduino/C++ and CircuitPython/Python library support, you can use these pads with any and all microcontroller or computer boards.

Documents for ATSAMD09D14A-MU:
The trusty seesaw I2C-to-anything chip can be seen here: https://learn.adafruit.com/adafruit-seesaw-atsamd09-breakout
it provides:
  • 3 x 12-bit ADC inputs
  • 3 x 8-bit PWM outputs
  • 7 x GPIO with selectable pullup or pulldown
  • 1 x NeoPixel output (up to 63 pixels)
  • 1 x EEPROM with 64 byte of NVM memory (handy for storing small access tokens or MAC addresses)
  • 1 x Interrupt output that can be triggered by any of the accessories
  • 2 x I2C address selection pins
  • 1 x Activity LED

Pinouts for seesaw: https://learn.adafruit.com/adafruit-seesaw-atsamd09-breakout/pinouts

this should connect directly to the MCP2221A which should plug directly into USB-A port and be readable by python.
I will work out details when I have the hardware.

I wrote the code (In 'C', Not python) for the keypad on a well known commercial fish finder with a TI msp430 MCU and made it entirely interrupt driven. I still have that code if I need to fall back on it. It was written for any 4 x 4 matrix.

There should be no need for the raspberry pi.

Quote:Check out the last post on this Adafruit thread about interrupt with Python

https://forums.adafruit.com/viewtopic.php?f=50&t=173615

This doesn't worry me yet. I've done a lot of embedded hardware work, starting back in the early 1980's with the intel 8080A.
I think (won't swear to it yet) I can make it work