another 'Serial' was not declared in this scope error

Hello all,

I'm new to arduino programming and run into issues with the examples.

I use an adafruit trinket 5v mini board, with Arduino 1.8.6 IDE, and USBtinyISP programmer setting.
When testing simple led blinking all works well.

However, none of the examples containing the Serial lines work.

After googling and reading on this forum, most issues are case related. Some are about SoftwareSerial library.
If I'm right I don't need the softwareserial, as this is included in the core now ?

This is the HT16K33 example code from the "Adafruit led backpack library":

/***************************************************
This is a library for our I2C LED Backpacks

Designed specifically to work with the Adafruit LED Matrix backpacks
----> Adafruit Mini 0.8 8x8 LED Matrix w/I2C Backpack - Yellow-Green : ID 872 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
----> Adafruit Mini 8x8 LED Matrix w/I2C Backpack - Yellow : ID 871 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
----> Adafruit Mini 8x8 LED Matrix w/I2C Backpack - Red : ID 870 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits

These displays use I2C to communicate, 2 pins are required to
interface. There are multiple selectable I2C addresses. For backpacks
with 2 Address Select pins: 0x70, 0x71, 0x72 or 0x73. For backpacks
with 3 Address Select pins: 0x70 thru 0x77

Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_LEDBackpack.h>

#ifndef _BV
#define _BV(bit) (1<<(bit))
#endif

Adafruit_LEDBackpack matrix = Adafruit_LEDBackpack();

uint8_t counter = 0;

void setup() {
Serial.begin(9600);
Serial.println("HT16K33 test");

matrix.begin(0x70); // pass in the address
}

void loop() {
// paint one LED per row. The HT16K33 internal memory looks like
// a 8x16 bit matrix (8 rows, 16 columns)
for (uint8_t i=0; i<8; i++) {
// draw a diagonal row of pixels
matrix.displaybuffer = _BV((counter+i) % 16) | _BV((counter+i+8) % 16) ;

  • }*
  • // write the changes we just made to the display*
  • matrix.writeDisplay();*
  • delay(100);*
  • counter++;*
  • if (counter >= 16) counter = 0; *
    }
    And below the error:
    Compiling sketch...
    /home/ken/arduino-1.8.6/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=attiny85 -DF_CPU=16000000L -DARDUINO=10806 -DARDUINO_AVR_TRINKET5 -DARDUINO_ARCH_AVR -I/home/ken/arduino-1.8.6/hardware/arduino/avr/cores/arduino -I/root/.arduino15/packages/adafruit/hardware/avr/1.4.13/variants/tiny8 -I/home/ken/arduino-1.8.6/hardware/arduino/avr/libraries/Wire/src -I/root/Arduino/libraries/Adafruit_GFX_Library -I/root/Arduino/libraries/Adafruit_LED_Backpack_Library /tmp/arduino_build_690654/sketch/HT16K33.ino.cpp -o /tmp/arduino_build_690654/sketch/HT16K33.ino.cpp.o
    /tmp/arduino_modified_sketch_938923/HT16K33.ino: In function 'void setup()':
    HT16K33:35:3: error: 'Serial' was not declared in this scope
  • Serial.begin(9600);*
  • ^*
    Using library Wire at version 1.0 in folder: /home/ken/arduino-1.8.6/hardware/arduino/avr/libraries/Wire
    Using library Adafruit_GFX_Library at version 1.8.4 in folder: /root/Arduino/libraries/Adafruit_GFX_Library
    Using library Adafruit_LED_Backpack_Library at version 1.1.6 in folder: /root/Arduino/libraries/Adafruit_LED_Backpack_Library
    exit status 1
    'Serial' was not declared in this scope
    I've attached a screenshot of the error with selected board too.
    Any help is welcome.

From Adafruit Trinket

Trinket does not have a Serial port connection for debugging so the serial port monitor will not be able to send/receive data

HT16K33:35:3: error: 'Serial' was not declared in this scope
   Serial.begin(9600);

Is it any wonder that Serial commands cause errors ?

Oops, thanks @UKHeliBob for pointing that out ... should have seen that.

Regards,
Ken.

For other people with the same mini board ...

Looks like it can be done using the TinyWireM lib (available at: GitHub - adafruit/TinyWireM: I2C library for Trinket and Gemma, adapted from BroHogan's code on Arduino Playground)
In combination with the TinyWireM and the Tiny_LEDBackPack library it seems to be working.

The adafruit trinket 5v has no i²c output, but it does have somethin called usp (universal serial port).

I got the wiring mixed up somehow, because one of the segments of the 1 digit 7 segment led stays on.
I'll have to figure that one out.