post the entire code
never post snippits
Where did you get the code?
What specific library are you using for the display? The Sparkfun library in the library manager has no function call setI2Caddress().
Code is from Github. I included the lines above but not void loop()
Please post the full sketch and the full error message, using code tags for both
To post the error message, click the "COPY ERROR MESSAGES" button in the IDE, paste the copied messages in a reply here, select all of it and click the < CODE > icon above the reply editor to add the code tags and then save the reply
Still need to see the entire code
#include <Wire.h>
#include <SparkFun_Alphanumeric_Display.h>
// I2C addresses for each Qwiic Alphanumeric Display
const byte displayAddresses[4] = { 0x70, 0x71, 0x72, 0x73 };
// Create display objects for each address
HT16K33 displays[4];
void setup() {
Wire.begin();
Serial.begin(9600);
// Initialize each display
for (int i = 0; i < 4; i++) {
HT16K33 displays[i].setI2CAddress(displayAddresses[i]);
if (!displays[i].begin()) {
Serial.print("Display ");
Serial.print(i);
Serial.println(" not detected!");
} else {
displays[i].clear();
displays[i].print("----");
}
}
}
void loop() {
int analogVals[4];
// Read analog inputs A0, A1, A2, A3
for (int i = 0; i < 4; i++) {
analogVals[i] = analogRead(A0 + i);
}
// Send readings to displays
for (int i = 0; i < 4; i++) {
// Convert analog value (0-1023) to string
char buffer[5];
snprintf(buffer, sizeof(buffer), "%4d", analogVals[i]);
displays[i].print(buffer);
}
delay(200); // Update rate
}
FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: C:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7
Using core 'arduino' from platform in folder: C:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7
Detecting libraries used...
C:\Users\twobi\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7\cores\arduino -IC:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7\variants\standard C:\Users\twobi\AppData\Local\arduino\sketches\8F1BCD3C2269FCEB77545149C89790D3\sketch\sketches_4displays_v1.ino.cpp -o nul
Generating function prototypes...
C:\Users\twobi\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7\cores\arduino -IC:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7\variants\standard C:\Users\twobi\AppData\Local\arduino\sketches\8F1BCD3C2269FCEB77545149C89790D3\sketch\sketches_4displays_v1.ino.cpp -o C:\temp\264534307\sketch_merged.cpp
C:\Users\twobi\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives C:\temp\264534307\sketch_merged.cpp
Compiling sketch...
"C:\Users\twobi\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7\cores\arduino" "-IC:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7\variants\standard" "C:\Users\twobi\AppData\Local\arduino\sketches\8F1BCD3C2269FCEB77545149C89790D3\sketch\sketches_4displays_v1.ino.cpp" -o "C:\Users\twobi\AppData\Local\arduino\sketches\8F1BCD3C2269FCEB77545149C89790D3\sketch\sketches_4displays_v1.ino.cpp.o"
D:\MAISON= HVAC\NEW control\anal displays\Arduino code\code\sketches_4displays_v1\sketches_4displays_v1.ino: In function 'void setup()':
D:\MAISON= HVAC\NEW control\anal displays\Arduino code\code\sketches_4displays_v1\sketches_4displays_v1.ino:16:24: error: expected initializer before '.' token
HT16K33 displays[i].setI2CAddress(displayAddresses[i]);
^
exit status 1
Compilation error: expected initializer before '.' token
not a member of class HT16K33
If you actually have 4 of the displays and want to display "hello stinky poo" across them then follow the SparkFun instructions for setting the different address for each board then wire them together as instructed by SparkFun and then run "4_displays.ino" from the Github distribution rather than that code that you posted in #46.
If instead you want to instantiate 4 independent displays you do it like this:
#include <Wire.h>
#include <SparkFun_Alphanumeric_Display.h>
// I2C addresses for each Qwiic Alphanumeric Display
const byte displayAddresses[4] = { 0x70, 0x71, 0x72, 0x73 };
// Create display objects for each address
HT16K33 displays[4];
void setup() {
Wire.begin();
Serial.begin(9600);
// Initialize each display
for (int i = 0; i < 4; i++) {
displays[i].begin(displayAddresses[i]);
if (!displays[i].begin()) {
Serial.print("Display ");
Serial.print(i);
Serial.println(" not detected!");
} else {
displays[i].clear();
displays[i].print("----");
}
}
}
void loop() {}
Thanks but:
FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: C:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7
Using core 'arduino' from platform in folder: C:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7
Detecting libraries used...
C:\Users\twobi\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7\cores\arduino -IC:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7\variants\standard C:\Users\twobi\AppData\Local\arduino\sketches\C325952FBCB7649F313B9E64A43453C2\sketch\Emily_Jane.ino.cpp -o nul
Generating function prototypes...
C:\Users\twobi\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7\cores\arduino -IC:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7\variants\standard C:\Users\twobi\AppData\Local\arduino\sketches\C325952FBCB7649F313B9E64A43453C2\sketch\Emily_Jane.ino.cpp -o C:\temp\1013794480\sketch_merged.cpp
C:\Users\twobi\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives C:\temp\1013794480\sketch_merged.cpp
Compiling sketch...
"C:\Users\twobi\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7\cores\arduino" "-IC:\Users\twobi\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.7\variants\standard" "C:\Users\twobi\AppData\Local\arduino\sketches\C325952FBCB7649F313B9E64A43453C2\sketch\Emily_Jane.ino.cpp" -o "C:\Users\twobi\AppData\Local\arduino\sketches\C325952FBCB7649F313B9E64A43453C2\sketch\Emily_Jane.ino.cpp.o"
Compiling libraries...
Compiling core...
Using precompiled core: C:\Users\twobi\AppData\Local\arduino\cores\arduino_avr_uno_6bc7f507f34b079cde8b830124de12d2\core.a
Linking everything together...
"C:\Users\twobi\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\Users\twobi\AppData\Local\arduino\sketches\C325952FBCB7649F313B9E64A43453C2/Emily_Jane.ino.elf" "C:\Users\twobi\AppData\Local\arduino\sketches\C325952FBCB7649F313B9E64A43453C2\sketch\Emily_Jane.ino.cpp.o" "C:\Users\twobi\AppData\Local\arduino\sketches\C325952FBCB7649F313B9E64A43453C2/..\..\cores\arduino_avr_uno_6bc7f507f34b079cde8b830124de12d2\core.a" "-LC:\Users\twobi\AppData\Local\arduino\sketches\C325952FBCB7649F313B9E64A43453C2" -lm
C:\temp\cco6SP0m.ltrans0.ltrans.o: In function global constructors keyed to 65535_0_Emily_Jane.ino.cpp.o.1763': <artificial>:(.text.startup+0x8c): undefined reference to vtable for HT16K33'
:(.text.startup+0x8e): undefined reference to vtable for HT16K33' C:\temp\cco6SP0m.ltrans0.ltrans.o: In function setup':
D:\MAISON= HVAC\NEW control\anal displays\Arduino code\code\Emily_Jane/Emily_Jane.ino:11: undefined reference to Wire' D:\MAISON\= HVAC\NEW control\anal displays\Arduino code\code\Emily_Jane/Emily_Jane.ino:11: undefined reference to Wire'
D:\MAISON= HVAC\NEW control\anal displays\Arduino code\code\Emily_Jane/Emily_Jane.ino:11: undefined reference to TwoWire::begin()' D:\MAISON\= HVAC\NEW control\anal displays\Arduino code\code\Emily_Jane/Emily_Jane.ino:17: undefined reference to Wire'
D:\MAISON= HVAC\NEW control\anal displays\Arduino code\code\Emily_Jane/Emily_Jane.ino:17: undefined reference to Wire' D:\MAISON\= HVAC\NEW control\anal displays\Arduino code\code\Emily_Jane/Emily_Jane.ino:17: undefined reference to HT16K33::begin(unsigned char, unsigned char, unsigned char, unsigned char, TwoWire&)'
D:\MAISON= HVAC\NEW control\anal displays\Arduino code\code\Emily_Jane/Emily_Jane.ino:18: undefined reference to HT16K33::begin(unsigned char, unsigned char, unsigned char, unsigned char, TwoWire&)' D:\MAISON\= HVAC\NEW control\anal displays\Arduino code\code\Emily_Jane/Emily_Jane.ino:23: undefined reference to HT16K33::clear()'
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
When I see this, I cleanly close serial monitor, close any used files and cleanly close the IDE. Windows takes many seconds to close every process (watch DevMan), so wait half a minute, before restarting the IDE, either with a sketch, or just the IDE, and open a sketch.
If that does not clear "it" up, then uninstall the IDE, reboot the computer, remove leftovers from moving folders, and re-install the IDE. You put junk where junk shouldn't be put. That's what I see... and others.
but... what else did you "not do?" And why are you frustrating your help?
Yes, yes, yes.
I’ve un-installed, deleted all files and directories, and cleaned the registry.
Did an install with version 2.3.7 only.
Loaded Sparkfun libs.
IT IS WORKING. YAHOO. Thanks to everyone!!
Happy to help!
You are welcome
Have a nice day!
