Hello! I'm programing on the Arduino IDE and I have the following error when compiling:
C:\Users\edelm\AppData\Local\Temp\cciLVR6L.ltrans0.ltrans.o: In function
setup': C:\Users\edelm\Documents\Arduino-Clock2/Arduino-Clock2.ino:4: undefined reference to
setDot(DigitPin, int)'
collect2.exe: error: ld returned 1 exit status
My Arduino-Clock.ino:
#include "SS5641AS.h"
void setup() {
setDot(DIG1, 1);
}
void loop() {
}
My SS5641AS.h file:
#ifndef _SS5641AS_H
#define _SS5641AS_H
typedef enum {
DIG1 = 1,
DIG2 = 5,
DIG3 = 6,
DIG4 = 7,
} DigitPin;
typedef enum {
A = 11,
B = 0,
C = 3,
D = 8,
E = 9,
F = 10,
G = 2,
H = 4,
} SegmentPin;
void update(void);
void loadNum(int, DigitPin);
void setDot(DigitPin, int);
void clear(DigitPin);
#endif
My SS5641AS.c file:
#include "SS5641AS.h"
#include "Arduino.h"
#include <stdint.h>
const uint8_t NUMBERS[11] = { 0b00111111, 0b00000110, 0b01011011, 0b01001111, 0b01100110, 0b01101101, 0b01111101, 0b00000111, 0b01111111, 0b01101111, 0b00000000 };
const DigitPin DIGITS[] = { DIG1, DIG2, DIG3, DIG4 };
const SegmentPin SEGMENTS[] = { A, B, C, D, E, F, G, H };
int digits[4] = { 10, 10, 10, 10 };
int dot[4] = { 0, 0, 0, 0 };
void update() {
static int current = 0;
digitalWrite(DIGITS[current], LOW);
for (int i = 1; i < 4; i++)
digitalWrite(DIGITS[(current + i) % 4], HIGH);
int state;
for (int i = 0; i < 7; i++) {
state = (NUMBERS[digits[current]] & 0x1 << i) ? HIGH : LOW;
digitalWrite(SEGMENTS[i], state);
}
if (dot[current])
digitalWrite(SEGMENTS[7], HIGH);
else
digitalWrite(SEGMENTS[7], LOW);
current = (current + 1) % 4;
}
void loadNum(int num, DigitPin pos) {
if (num < 0 || num > 9) return;
switch (pos) {
case DIG1:
digits[0] = num;
break;
case DIG2:
digits[1] = num;
break;
case DIG3:
digits[2] = num;
break;
case DIG4:
digits[3] = num;
break;
}
}
void setDot(DigitPin pin, int set) {
switch (pin) {
case DIG1:
dot[0] = set;
break;
case DIG2:
dot[1] = set;
break;
case DIG3:
dot[2] = set;
break;
case DIG4:
dot[3] = set;
break;
}
}
I would really appreciate any help. Thank you!