Arduino IDE reports no connection to NeoKey

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
firex7261
 
Posts: 4
Joined: Thu Nov 03, 2022 5:33 pm

Arduino IDE reports no connection to NeoKey

Post by firex7261 »

Recently picked up two 1x4 NeoKey boards and a Feather RP 2040. Updated to the latest version of the Arduino IDE, libraries, and Circuit Python. I am using the "basic" example under the "Adafruit Seesaw" library for the 1x4 NeoKey, and while it will compile and upload when I check the serial monitor it keeps reporting "Could not start NeoKey, check wiring?".

I have tried connecting both boards using both cables (disconnecting power between tries). I also confirmed I am using the correct I2C address.

Verbose Output:

Code: Select all

attached due to charecter limit
verbose output.txt
(78.98 KiB) Downloaded 5 times
Example sketch code:

Code: Select all

#include "Adafruit_NeoKey_1x4.h"
#include "seesaw_neopixel.h"

Adafruit_NeoKey_1x4 neokey;  // Create the NeoKey object

void setup() {
  Serial.begin(115200);
  while (! Serial) delay(10);
   
  if (! neokey.begin(0x30)) {     // begin with I2C address, default is 0x30
    Serial.println("Could not start NeoKey, check wiring?");
    while(1) delay(10);
  }
  
  Serial.println("NeoKey started!");

  // Pulse all the LEDs on to show we're working
  for (uint16_t i=0; i<neokey.pixels.numPixels(); i++) {
    neokey.pixels.setPixelColor(i, 0x808080); // make each LED white
    neokey.pixels.show();
    delay(50);
  }
  for (uint16_t i=0; i<neokey.pixels.numPixels(); i++) {
    neokey.pixels.setPixelColor(i, 0x000000);
    neokey.pixels.show();
    delay(50);
  }
}

void loop() {
  uint8_t buttons = neokey.read();

  // Check each button, if pressed, light the matching neopixel
  
  if (buttons & (1<<0)) {
    Serial.println("Button A");
    neokey.pixels.setPixelColor(0, 0xFF0000); // red
  } else {
    neokey.pixels.setPixelColor(0, 0);
  }

  if (buttons & (1<<1)) {
    Serial.println("Button B");
    neokey.pixels.setPixelColor(1, 0xFFFF00); // yellow
  } else {
    neokey.pixels.setPixelColor(1, 0);
  }
  
  if (buttons & (1<<2)) {
    Serial.println("Button C");
    neokey.pixels.setPixelColor(2, 0x00FF00); // green
  } else {
    neokey.pixels.setPixelColor(2, 0);
  }

  if (buttons & (1<<3)) {
    Serial.println("Button D");
    neokey.pixels.setPixelColor(3, 0x00FFFF); // blue
  } else {
    neokey.pixels.setPixelColor(3, 0);
  }  

  neokey.pixels.show();
  
  delay(10);    // don't print too fast
}



/******************************************/

// Input a value 0 to 255 to get a color value.
// The colors are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return seesaw_NeoPixel::Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return seesaw_NeoPixel::Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return seesaw_NeoPixel::Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
  return 0;
}

User avatar
adafruit_support_carter
 
Posts: 29168
Joined: Tue Nov 29, 2016 2:45 pm

Re: Arduino IDE reports no connection to NeoKey

Post by adafruit_support_carter »

The STEMMA QT connector on the Feather RP2040 ends up being Wire1 in Arduino:
https://learn.adafruit.com/adafruit-fea ... qt-3084853

Therefore, you'll need to modify the example sketch to override the use of the default Wire (without a 1).

Change this line:

Code: Select all

Adafruit_NeoKey_1x4 neokey;
to:

Code: Select all

Adafruit_NeoKey_1x4 neokey(NEOKEY_1X4_ADDR, &Wire1);

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”