I recently received a NeoKey 1x4 then 3D printed a mount for it. Next I got to the part where I'd code it up in CP. I clicked on the link from the product page and it brings me to the Seesaw library. Nothing there for this NeoKey device. Ok, so that must mean it is obvious how to use it with Seesaw. Perhaps to somebody, but not to me! I've looked at the Keypad definition. I've looked at the -- what would seem to be similar -- Trellis definition. I've looked at the Arduino version of the NeoKey1x4 library. The light has failed to go on.
Anybody have some sample CP code for reading the key presses and lighting the lights on this device?
NeoKey 1x4 Qt I2c CircuitPython
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- dastels
- Posts: 15656
- Joined: Tue Oct 20, 2015 3:22 pm
Re: NeoKey 1x4 Qt I2c CircuitPython
I don't see CP support yet. It will be part of the seesaw library since it's a seesaw based board. It's a relatively new product so CP support is probably in the queue. I notice there's not a specific guide for it either.
There is Arduino support so you could always reverse engineer that if you want a project. Otherwise I'd say keep checking for official support in the seesaw library.
Dave
There is Arduino support so you could always reverse engineer that if you want a project. Otherwise I'd say keep checking for official support in the seesaw library.
Dave
- pfcurtis
- Posts: 3
- Joined: Wed Nov 28, 2012 3:37 pm
Re: NeoKey 1x4 Qt I2c CircuitPython
I was just starting this ... from the C++ header file, it looks like the NeoPixels are on pin 3, and the buttons on 4, 5, 6, and 7. Is that what you found?
An example code would be greatly appreciated!
An example code would be greatly appreciated!
- esquagga
- Posts: 29
- Joined: Sat Apr 08, 2017 5:17 pm
Re: NeoKey 1x4 Qt I2c CircuitPython
Yes, that is what I found. I was totally confused at first, comparing the Arduino code to the other Seesaw Python modules. What I came up with is a lot like the Arduino code, but I hope more Pythonic. I submitted a pull request; I think that means you can see it. I've never done that before except for very minor fixes, so I hope that's okay. In any case, now I can get back to what I wanted the keypad for in the first place. Thanks for the nudge.
- pfcurtis
- Posts: 3
- Joined: Wed Nov 28, 2012 3:37 pm
Re: NeoKey 1x4 Qt I2c CircuitPython
I will test your code tomorrow. I'm working with a single NeoKey 1x4 connected to a Pi Zero W.
- esquagga
- Posts: 29
- Joined: Sat Apr 08, 2017 5:17 pm
Re: NeoKey 1x4 Qt I2c CircuitPython
Cool. But I see it is failing to build, yet I have no idea what the error message means.
- pfcurtis
- Posts: 3
- Joined: Wed Nov 28, 2012 3:37 pm
Re: NeoKey 1x4 Qt I2c CircuitPython
OK ... I have been playing with the NeoKey 1x4 with the standard, out of the box Python Seesaw library. This is the first code. It lights all the neopixels red, but you can see the right addresses, etc.
>>> import board
>>> from adafruit_seesaw import seesaw, neopixel
>>> import adafruit_pypixelbuf as _pixelbuf
>>> seesaw = seesaw.Seesaw(board.I2C(), 0x30)
>>> pixel = neopixel.NeoPixel(seesaw, 3, 4)
>>> pixel.brightness = 0.5
>>> pixel.fill(_pixelbuf.colorwheel(0))
You'll need to pip install adafruit-circuitpython-seesaw, and have a adafruit_pypixelbuf installed or available. (https://raw.githubusercontent.com/adafr ... Pypixelbuf)
More to come as I work out the basic demo ... press a button, light the neopixel.
>>> import board
>>> from adafruit_seesaw import seesaw, neopixel
>>> import adafruit_pypixelbuf as _pixelbuf
>>> seesaw = seesaw.Seesaw(board.I2C(), 0x30)
>>> pixel = neopixel.NeoPixel(seesaw, 3, 4)
>>> pixel.brightness = 0.5
>>> pixel.fill(_pixelbuf.colorwheel(0))
You'll need to pip install adafruit-circuitpython-seesaw, and have a adafruit_pypixelbuf installed or available. (https://raw.githubusercontent.com/adafr ... Pypixelbuf)
More to come as I work out the basic demo ... press a button, light the neopixel.
- Discotehk
- Posts: 6
- Joined: Sat Sep 12, 2020 4:14 am
Re: NeoKey 1x4 Qt I2c CircuitPython
Hey! Been lurking this thread for a little while and after bit bashing pfcurtis pixel light up and the seesaw guide in Learn I've got some working keys using the following
Forum spam blocker didn't like Switch three for whatever reason so I swapped 3 for 5.
Forum spam blocker didn't like Switch three for whatever reason so I swapped 3 for 5.
Code: Select all
import board
from digitalio import Direction, Pull
from adafruit_debouncer import Debouncer
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
from adafruit_seesaw import seesaw, neopixel, digitalio
# seesaw setup #
seesaw = seesaw.Seesaw(board.I2C(), 0x30)
# neopixel setup #
pixels = neopixel.NeoPixel(seesaw, 3, 4)
pixels.fill((0, 0, 255))
# HID keyboard setup #
keyboard = Keyboard(usb_hid.devices)
keyboard_layout = KeyboardLayoutUS(keyboard)
# Key Setup #
switch1 = digitalio.DigitalIO(seesaw, 4)
switch1.direction = Direction.INPUT
switch1.pull = Pull.UP
deb_switch1 = Debouncer(switch1)
switch2 = digitalio.DigitalIO(seesaw, 5)
switch2.direction = Direction.INPUT
switch2.pull = Pull.UP
deb_switch2 = Debouncer(switch2)
switch5 = digitalio.DigitalIO(seesaw, 6)
switch5.direction = Direction.INPUT
switch5.pull = Pull.UP
deb_switch5 = Debouncer(switch5)
switch4 = digitalio.DigitalIO(seesaw, 7)
switch4.direction = Direction.INPUT
switch4.pull = Pull.UP
deb_switch4 = Debouncer(switch4)
while True:
deb_switch1.update()
if deb_switch1.rose:
print("press1")
if deb_switch1.fell:
print("release1")
deb_switch2.update()
if deb_switch2.rose:
print("press2")
if deb_switch2.fell:
print("release2")
deb_switch5.update()
if deb_switch5.rose:
print("press3")
if deb_switch5.fell:
print("release3")
deb_switch4.update()
if deb_switch4.rose:
print("press4")
if deb_switch4.fell:
print("release4")
- Discotehk
- Posts: 6
- Joined: Sat Sep 12, 2020 4:14 am
Re: NeoKey 1x4 Qt I2c CircuitPython
So the library wasn't part of the bundle yet. Saw on pick of the week that's it's hanging out separate in the github.
https://github.com/adafruit/Adafruit_Ci ... hon_NeoKey
https://github.com/adafruit/Adafruit_Ci ... hon_NeoKey
- esquagga
- Posts: 29
- Joined: Sat Apr 08, 2017 5:17 pm
Re: NeoKey 1x4 Qt I2c CircuitPython
Interesting. That has almost none of the functionality of the Arduino library. Looks like it's just a starting point, but it does show where a library should fit. The thinking seems to be to make a place for dimensions in addition to 1x4.
Please be positive and constructive with your questions and comments.