Code umschreiben für Adafruit trellis

Hallo!

Ich wollte fragen ob mir jemand helfen könnte diesen Code:
klick mich
umzuschreiben, um das Adafruit Trellis Buttonpad zu verwenden?
Die LED´s können vernachlässigt werden, die brauche ich sowieso nicht. Ich möchte das Board nur verwenden da ich es noch von einem anderen Projekt übrig habe.

Vielen Dank und viele Grüße
Paul

Was ist dabei Dein Beitrag?
Diese Frage geschrieben zu haben?

Das mußt Du schon selbst machen und wenn Du Probleme hast helfen wir Dir diese Probleme zu lösen.
Weiß nicht wie gilt nicht.

Grüße Uwe

Okay also ich habe jetzt mit verschiedenen Codes rum gespielt und hab es geschafft die Zahlen 1-16 über usb an meinen Pc zu senden. Für mein "Projekt" müsste ich aber mit den Buttons Buchstaben senden und keine Zahlen. Wenn ich aber Buchstaben in Matrix für i schreibe bekomme ich die Fehlermeldung "...was not declared in this scope".

Hier mein bisheriger Code:

#include <Wire.h>
#include "Adafruit_Trellis.h"




Adafruit_Trellis matrix0 = Adafruit_Trellis();

// uncomment the below to add 3 more matrices
/*
Adafruit_Trellis matrix1 = Adafruit_Trellis();
Adafruit_Trellis matrix2 = Adafruit_Trellis();
Adafruit_Trellis matrix3 = Adafruit_Trellis();
// you can add another 4, up to 8
*/

// Just one
Adafruit_TrellisSet trellis =  Adafruit_TrellisSet(&matrix0);
// or use the below to select 4, up to 8 can be passed in
//Adafruit_TrellisSet trellis =  Adafruit_TrellisSet(&matrix0, &matrix1, &matrix2, &matrix3);

// set to however many you're working with here, up to 8
#define NUMTRELLIS 1

#define numKeys (NUMTRELLIS * 16)

// Connect Trellis Vin to 5V and Ground to ground.
// Connect the INT wire to pin #A2 (can change later!)
#define INTPIN A2
// Connect I2C SDA pin to your Arduino SDA line
// Connect I2C SCL pin to your Arduino SCL line
// All Trellises share the SDA, SCL and INT pin! 
// Even 8 tiles use only 3 wires max

uint8_t note[] = {
  1, 2, 3, 4,
  5, 6, 7, 8,
  9, 10, 11, 12,
  13, 14, 15, 16
  };


void setup() {
  Serial.begin(9600);
  Serial.println("Trellis Demo");

  // INT pin requires a pullup
  pinMode(INTPIN, INPUT);
  digitalWrite(INTPIN, HIGH);
  
  // begin() with the addresses of each panel in order
  // I find it easiest if the addresses are in order
  trellis.begin(0x70);  // only one
  // trellis.begin(0x70, 0x71, 0x72, 0x73);  // or four!

  // light up all the LEDs in order
  for (uint8_t i=0; i<numKeys; i++) {
    trellis.setLED(i);
    trellis.writeDisplay();    
    delay(50);
  }
  // then turn them off
  for (uint8_t i=0; i<numKeys; i++) {
    trellis.clrLED(i);
    trellis.writeDisplay();    
    delay(50);
  }
}


void loop() {
  delay(30); // 30ms delay is required, dont remove me!
  
 
    // If a button was just pressed or released...
    if (trellis.readSwitches()) {
      // go through every button
      for (uint8_t i=0; i<numKeys; i++) {
	// if it was pressed, turn it on
	if (trellis.justPressed(i)) {
	  Serial.print("v"); Serial.println(i);
         Keyboard.println(note[i]);
	  trellis.setLED(i);
	} 
	// if it was released, turn it off
	if (trellis.justReleased(i)) {
	  Serial.print("^"); Serial.println(i);
	  trellis.clrLED(i);
	}
      }
      // tell the trellis to set the LEDs we requested
      trellis.writeDisplay();
    }
  }

vielen Dank!

Wenn es dir nur drum geht, 16 verschiedene Buchstaben zu erhalten, probier mal

char note[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'
              , 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p'
  };

statt deines uint8_t note[] ( und verwende die Buschstaben, die du sehen willst... )

ansonsten verstehe ich vermutlich dein Problem nicht ...

Perfekt!
funktioniert einwandfrei 8)

vielen dank für die schnelle hilfe!