Is the trinket sketch for the 16x8 led backpack available

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
YoungSoul
 
Posts: 20
Joined: Mon Sep 01, 2014 2:34 pm

Is the trinket sketch for the 16x8 led backpack available

Post by YoungSoul »

Hi Everyone

I was wondering if the exact sketch that is shown in this project page:

http://www.adafruit.com/products/2042

which shows the word: 'Adafruit!' scrolling across the 16x8 display using a Trinket is available. I am trying to get something like this working and it would be nice to start with a known working example.

Thanks very much in advance.

Pat

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Is the trinket sketch for the 16x8 led backpack availabl

Post by adafruit_support_mike »

That would be the 'matrix16x8' sketch in the 'examples' folder that comes with the Adafruit LED Backpack Library:

https://github.com/adafruit/Adafruit-LE ... ck-Library

User avatar
YoungSoul
 
Posts: 20
Joined: Mon Sep 01, 2014 2:34 pm

Re: Is the trinket sketch for the 16x8 led backpack availabl

Post by YoungSoul »

Thanks very much for the response.

That is actually what I thought initially - until I went to actually try it.

There were a number of problems compiling that example, which leads me to believe that either I have an issue with my setup or that is not the actual sketch for scrolling text with the Trinket.

First - I have to comment out the following lines because Serial is not defined
//Serial.begin(9600);
//Serial.println("16x8 LED Matrix Test");

After that, I get a numbers or errors like the following:
/Applications/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/libraries/Wire/utility/twi.c: In function 'twi_init':
/Applications/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/libraries/Wire/utility/twi.c:76: error: 'SDA' undeclared (first use in this function)

when I checked the file: pins_arduino.h in:
/Applications/Adafruit Arduino 1.0.5.app/Contents/Resources/Java/hardware/arduino/variants/tiny8
There is no definition for SDA, or SCL, or the multitude of other constants it is looking for.

Under other variants I see it is defined:
./flora/pins_arduino.h:static const uint8_t SDA = 2;
./leonardo/pins_arduino.h:static const uint8_t SDA = 2;
./mega/pins_arduino.h:static const uint8_t SDA = 20;
./standard/pins_arduino.h:static const uint8_t SDA = 18;

but not tiny8 - which I believe is the variant for trinket.

the libraries that I have installed are:
Adafruit_GFX
Adafruit_LEDBackpack
MIDI
TinyWireM

and I am using the Adafruit Arduino IDE 1.0.5

Any other thoughts on how to get that example working, is greatly appreciated.

Thank you

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Is the trinket sketch for the 16x8 led backpack availabl

Post by adafruit_support_mike »

Whoops.. I didn't read the headers to make sure the sketch was Trinket compatible.

Generally speaking, you need to replace:

Code: Select all

#include <Wire.h>
with:

Code: Select all

#include "TinyWireM.h"
and remove any references to Serial.

Then the sketch will compile for a Trinket and give you a warning about the code being too big to fit.

Let me ask around and see if someone still has the code used for that demo.

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: Is the trinket sketch for the 16x8 led backpack availabl

Post by adafruit2 »

Code: Select all

#include <TinyWireM.h>
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"

Adafruit_8x16matrix matrix = Adafruit_8x16matrix();

void setup() {
  //Serial.begin(9600);
  //Serial.println("16x8 LED Matrix Test");
  
  matrix.begin(0x70);  // pass in the address
  
  matrix.setBrightness(4);
}

static const uint8_t PROGMEM
  smile_bmp[] =
  { B00111100,
    B01000010,
    B10100101,
    B10000001,
    B10100101,
    B10011001,
    B01000010,
    B00111100 },
  neutral_bmp[] =
  { B00111100,
    B01000010,
    B10100101,
    B10000001,
    B10111101,
    B10000001,
    B01000010,
    B00111100 },
  frown_bmp[] =
  { B00111100,
    B01000010,
    B10100101,
    B10000001,
    B10011001,
    B10100101,
    B01000010,
    B00111100 },
  alien1_bmp[] = {
     B00011000, // This is the first frame for alien #1
B00111100, // If you squint you can kind of see the
B01111110, // image in the 0's and 1's.
B11011011,
B11111111,
B00100100,
B01011010,
B10100101, },
  alien2_bmp[] = {
    B00100100, // Second frame for alien #3
    B10100101,
    B11111111,
    B11011011,
    B11111111,
    B01111110,
    B00100100,
    B01000010 };

void loop() {
  matrix.setRotation(1);
    
  matrix.clear();
  matrix.drawBitmap(0, 0, smile_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  
//  matrix.clear();
  matrix.drawBitmap(8, 0, frown_bmp, 8, 8, LED_ON);
  matrix.writeDisplay();
  delay(5000);
  

  matrix.setTextSize(1);
  matrix.setTextWrap(false);  // we dont want text to wrap so it scrolls nicely
  matrix.setTextColor(LED_ON);
  matrix.setRotation(1);
  for (int8_t x=15; x>=-70; x--) {
    matrix.clear();
    matrix.setCursor(x,0);
    matrix.print("Adafruit!");
    matrix.writeDisplay();
    delay(100);
  }

}

User avatar
YoungSoul
 
Posts: 20
Joined: Mon Sep 01, 2014 2:34 pm

Re: Is the trinket sketch for the 16x8 led backpack availabl

Post by YoungSoul »

Awesome! Thank you. The sketch works great.

User avatar
ECW3
 
Posts: 2
Joined: Mon Nov 24, 2014 10:44 pm

Re: Is the trinket sketch for the 16x8 led backpack availabl

Post by ECW3 »

Hello! I run into trouble when I try to use this code . When I try to verify the code posted by Adafruit2, I get the following error:
Untitled.png
Untitled.png (75.99 KiB) Viewed 680 times
I'm pretty sure I have the TinyWireM library installed correctly.
Untitled2.png
Untitled2.png (19.29 KiB) Viewed 680 times
I also have the Adafruit_LEDBackPack and Adafruit_GFX libraries installed.

Any idea where I could have gone wrong?

I'm ultimately hoping to use this with a pro trinket.

Thanks!

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Is the trinket sketch for the 16x8 led backpack availabl

Post by adafruit_support_mike »

It looks like the compiler can't find the libraries.

This tutorial has complete instructions for installing Arduino libraries:
https://learn.adafruit.com/adafruit-all ... -libraries

User avatar
ECW3
 
Posts: 2
Joined: Mon Nov 24, 2014 10:44 pm

Re: Is the trinket sketch for the 16x8 led backpack availabl

Post by ECW3 »

You were right. I had multiple copies of the same .h file in different folders in my library. Everything is working like a charm now! The LED display is beautiful!

Thanks a million!

User avatar
sLpFhaWK
 
Posts: 6
Joined: Fri Mar 10, 2017 12:28 am

Re: Is the trinket sketch for the 16x8 led backpack availabl

Post by sLpFhaWK »

I know this is old, but I am not having luck adding a 2nd 8x8 matrice using the trinket 5v.

when I add matrix1.begin(0x70); it says matrix1 was not defined in this scope.

i found the correct code to get scrolling text, but i can't get 2 to work. I also put in Fidget Spinners and it stops at the 2nd N in spinners. =/

I'm guessing it's because of the lack of memory in the trinket for the lack of letters, but the 2nd matrice i thought would work.

I changed the address, so 1 is at 70 and the other is 71, when i swap them in the matrix.begin line it works, but i can't get both together.

also i changed the rotation to 0 and now the letters like g and p have a pixel that is on the top, how do i fix that? I'm assuming it's in the set rotation field, but i'm not sure what to change.

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

Return to “General Project help”