What's new

C & C++ Arduino

Soobin_ms

Eternal Poster
Established
Joined
Oct 24, 2020
Posts
808
Solutions
3
Reaction
299
Points
385
C:\Users\StudyPC\AppData\Local\Temp\ccdGdNJA.ltrans0.ltrans.o: In function `setup':
C:\Users\StudyPC\Desktop\sketch_jul01d/sketch_jul01d.ino:53: undefined reference to `TM1637::set(unsigned char, unsigned char, unsigned char)'
C:\Users\StudyPC\Desktop\sketch_jul01d/sketch_jul01d.ino:54: undefined reference to `TM1637::point(bool)'
C:\Users\StudyPC\Desktop\sketch_jul01d/sketch_jul01d.ino:55: undefined reference to `TM1637::init()'
C:\Users\StudyPC\AppData\Local\Temp\ccdGdNJA.ltrans0.ltrans.o: In function `showNumber':
C:\Users\StudyPC\Desktop\sketch_jul01d/sketch_jul01d.ino:115: undefined reference to `TM1637::display(unsigned char, signed char)'
C:\Users\StudyPC\Desktop\sketch_jul01d/sketch_jul01d.ino:116: undefined reference to `TM1637::display(unsigned char, signed char)'
C:\Users\StudyPC\Desktop\sketch_jul01d/sketch_jul01d.ino:121: undefined reference to `TM1637::display(unsigned char, signed char)'
C:\Users\StudyPC\Desktop\sketch_jul01d/sketch_jul01d.ino:133: undefined reference to `TM1637::display(unsigned char, signed char)'
C:\Users\StudyPC\Desktop\sketch_jul01d/sketch_jul01d.ino:126: undefined reference to `TM1637::display(unsigned char, signed char)'
C:\Users\StudyPC\AppData\Local\Temp\ccdGdNJA.ltrans0.ltrans.o:C:\Users\StudyPC\Desktop\sketch_jul01d/sketch_jul01d.ino:132: more undefined references to `TM1637::display(unsigned char, signed char)' follow
C:\Users\StudyPC\AppData\Local\Temp\ccdGdNJA.ltrans0.ltrans.o: In function `__static_initialization_and_destruction_0':
C:\Users\StudyPC\Desktop\sketch_jul01d/sketch_jul01d.ino:6: undefined reference to `TM1637::TM1637(unsigned char, unsigned char)'
collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1


paano po ifix yan?
 
It looks like you are encountering compilation errors related to undefined references to functions in the TM1637 library. To fix this issue, you can try the following steps:

1. Make sure you have properly installed the TM1637 library in your Arduino IDE. You can check by going to "Sketch" > "Include Library" and see if "TM1637" is listed there. If not, you may need to install the library.

2. If the library is already installed, try deleting the library files and reinstalling them. Sometimes, the library files can get corrupted during the installation process.

3. Ensure that you have included the TM1637 library at the beginning of your sketch. Add the following line of code at the top of your sketch:

C++:
#include <TM1637.h>

4. Check the wiring connections between your Arduino board and the TM1637 display. Make sure all the connections are correct and secure.

5. Verify that you are using the correct methods and function calls from the TM1637 library. Double-check the documentation or examples provided with the library to ensure you are using the correct syntax.

6. If the issue persists, try using a different version of the TM1637 library. Sometimes, compatibility issues can arise with certain versions of libraries.

By following these steps, you should be able to resolve the compilation errors and successfully compile your code.
 
It looks like you are encountering compilation errors related to undefined references to functions in the TM1637 library. To fix this issue, you can try the following steps:

1. Make sure you have properly installed the TM1637 library in your Arduino IDE. You can check by going to "Sketch" > "Include Library" and see if "TM1637" is listed there. If not, you may need to install the library.

2. If the library is already installed, try deleting the library files and reinstalling them. Sometimes, the library files can get corrupted during the installation process.

3. Ensure that you have included the TM1637 library at the beginning of your sketch. Add the following line of code at the top of your sketch:

C++:
#include <TM1637.h>

4. Check the wiring connections between your Arduino board and the TM1637 display. Make sure all the connections are correct and secure.

5. Verify that you are using the correct methods and function calls from the TM1637 library. Double-check the documentation or examples provided with the library to ensure you are using the correct syntax.

6. If the issue persists, try using a different version of the TM1637 library. Sometimes, compatibility issues can arise with certain versions of libraries.

By following these steps, you should be able to resolve the compilation errors and successfully compile your code.
there is. wait see my code


#include <TM1637.h>
// include display library
#include <pitches.h> // include pitches
TM1637 *_display = new TM1637(12, 13); // create display object, 12 = CLK (clock), 13 = D10 (data)
// music
int songState = 0;
int melody[] = {
NOTE_F4, NOTE_E4, NOTE_D4, NOTE_CS4,
NOTE_C4, NOTE_B3, NOTE_AS3, NOTE_A3,
NOTE_G3, NOTE_A3, NOTE_AS3, NOTE_A3,
NOTE_G3, NOTE_C4, 0,
};
int tempo[] = {
8, 16, 8, 16,
8, 16, 8, 16,
16, 16, 16, 8,
16, 8, 3,


};
// non blocking setup
// free play
unsigned long previousMillis1 = 0; // time words last changed
const long interval1 = 1500; // interval between changing
// music
unsigned long previousMillis2 = 0; // time last changed
const long interval2 = 100; // interval between notes
int displayStatus = 0; // keep track of what's displayed
int mode = 0; // keep track of game mode -- change to 0 or 1 for different modes
bool countdown = false;
unsigned long previousMillis3 = 0; // time last changed
const long interval3 = 1000; // interval between countdown
int count = 20; // challenge mode timer
void setup() {
// put your setup code here, to run once:
pinMode(9, INPUT); // setup circuit
pinMode(10, OUTPUT); // setup buzzer 1
pinMode(11, OUTPUT); // setup buzzer 2
pinMode(2, INPUT); // setup button

_display->set(5); // set brightness
_display->point(false); // remove colon
_display->init(); // start display
}
void loop() {
// put your main code here, to run repeatedly:
if(mode == 0) {
// challenge mode
if(digitalRead(2) == HIGH) {
delay(25);
if(digitalRead(2) == HIGH) {
countdown = true; // stop the countdown
}
else {
countdown = false; // stop the countdown
}
}
if(countdown) {
showCountdown(); // advance countdown
}
}
else {
// free play
toggleFreePlay();
}
if(digitalRead(10) == HIGH) {
delay(25);
if(digitalRead(10) == HIGH) {
while(digitalRead(10) == HIGH) {
buzz(11, NOTE_B0, 1000/24);
}
}
}
else
sing();
}
void showCountdown() {
// countdown the time remaining
unsigned long currentMillis = millis(); // current time
if (currentMillis - previousMillis3 >= interval3) {
previousMillis3 = currentMillis;
--count;
showNumber(count);
if(count == 0) {
// game over
countdown = false;
count = 20;
// reset countdown
// buzz 3 times
buzz(11, NOTE_B0, 1000/24);
delay(100);
buzz(11, NOTE_B0, 1000/24);
delay(100);
buzz(11, NOTE_B0, 1000/24);
}
}
}
void showNumber(int number) {
// show numbers (maximum 99) on display
_display->display(0, 25); // write - to segment 1
_display->display(3, 25); // write - to segment 4

// write number to middle of display
if(number == 10)
{
_display->display(1,1);
_display->display(2,0);
}
else if(number > 9)
{
_display->display(1,1);
int newVal = number - 10;
_display->display(2, newVal);
}
else
{
_display->display(1,0);
_display->display(2,number);
}
}
void toggleFreePlay() {
// scroll between words without blocking
unsigned long currentMillis = millis(); // current time
if (currentMillis - previousMillis1 >= interval1) {
previousMillis1 = currentMillis;
if(displayStatus == 1)
showPlay();
else
showFree();
}
}
void showPlay() {
// write "PLAY" to the display
_display->display(0, 21); // write P to segment 1
_display->display(1, 18); // write L to segment 2
_display->display(2, 10); // write A to segment 3
_display->display(3, 4); // write Y to segment 4
displayStatus = 2;
}
void showFree() {
// write "Free" to the display
_display->display(0, 15); // write F to segment 1
_display->display(1, 23); // write r to segment 2
_display->display(2, 14); // write E to segment 3
_display->display(3, 14); // write E to segment 4
displayStatus = 1;
}
void buzz(int targetPin, long frequency, long length) {
/* Buzzer example function by Rob Faludi
You do not have permission to view the full content of this post. Log in or register now.

*/
long delayValue = 1000000/frequency/2; // calculate the delay value between transitions
//// 1 second's worth of microseconds, divided by the frequency, then split in half since
//// there are two phases to each cycle
long numCycles = frequency * length/ 1000; // calculate the number of cycles for proper timing
//// multiply frequency, which is really cycles per second, by the number of seconds to
//// get the total number of cycles to produce
for (long i=0; i < numCycles; i++){ // for the calculated length of time...
digitalWrite(targetPin,HIGH); // write the buzzer pin high to push out the diaphragm
delayMicroseconds(delayValue); // wait for the calculated delay value
digitalWrite(targetPin,LOW); // write the buzzer pin low to pull back the diaphragm
delayMicroseconds(delayValue); // wait again for the calculated delay value
}
}
void sing() {
// play the song in a non blocking way
unsigned long currentMillis = millis();
if (currentMillis - previousMillis2 >= interval2) {
previousMillis2 = currentMillis;
int noteDuration = 1000 / tempo[songState];
buzz(10, melody[songState], noteDuration);
int pauseBetweenNotes = noteDuration;
delay(pauseBetweenNotes);
// stop the tone playing:
buzz(10, 0, noteDuration);

++songState;
// start song again if finished
if(songState > 79) {
songState = 14; // skip intro
}
}
}
 
Back
Top