// unused pin: 0 and 1, 4, 13, and by removing DP pin, A3
// digital pin 0 and 1 are not used, these are usually used for communication
// with host and can be repurposed if more pins are needed.
#include <SevSeg.h>
int buttonup = 2; // pin to connect the UP button
int buttondn = 3; // pin to connect the DOWN button
int presses = 0; // variable to store number of presses
int buttonidle = 0; // how long since last button press?
int LEDdefault=70; // LED display brightness, 0 to 100, I prefer 70
long time = 0; // used for debounce
long debounce = 200; // how many ms to "debounce"
const byte numPins = 4; // how many address, 5 for 64k and 6 for 128k
int state; // used for HIGH or LOW
byte pins[] = {5, 6, 7, 8}; // pins to connect SRAM address
int leddisplay = 1; // start LED display at 1
SevSeg sevseg; //Instantiate a seven segment controller object
void setup()
{
/* we setup all pins as OUTPUT and start at LOW */
for (int i = 0; i < numPins; i++) {
pinMode(pins[i], OUTPUT);
digitalWrite (pins[i], LOW);
}
pinMode(buttonup, INPUT);
pinMode(buttondn, INPUT);
/* use pin 2 and 3 which has interrupt 0 and 1 on Arduino UNO and ATMega328 */
// attachInterrupt(0, countup, FALLING);
// attachInterrupt(1, countdn, FALLING);
}
// setting up LED display
byte numDigits = 2; // 2 digits for 16, 32, and 64 pages.
byte digitPins[] = {A1, 11}; // equals to number of digits used,
byte segmentPins[] = {10, 9, A0, A2, A3, 12, 13, A5}; // pin a, b, c, d, e, f, g, and DP
sevseg.begin(COMMON_ANODE, numDigits, digitPins, segmentPins);
// change to cathode if used
sevseg.setBrightness(LEDdefault); // set LED display
}
void loop()
{
/* convert presses to binary and store it as a string */
String binNumber = String(presses, BIN);
buttonidle++;
if (buttonidle > 10000) {
displayidle;
}
if ((0 <= presses) && (presses <= 15)) { // change to 31 or 63 for 64k and 128k
digitalWrite(pins[0], (presses & B1));
digitalWrite(pins[1], (presses & B10));
digitalWrite(pins[2], (presses & B100));
digitalWrite(pins[3], (presses & B1000));
} else {
if (presses > 15) presses = 15;
if (presses < 0) presses = 0; // change both lines from 15 to 31 for 64K, 63 for 128k
}
// display current page
leddisplay = presses + 1 ;
sevseg.setNumber(leddisplay, 0);
sevseg.refreshDisplay(); // Must run repeatedly
}
/* function to count the presses */
void countup() {
// we debounce the button and increase the presses
if (millis() - time > debounce) presses++;
time = millis();
buttonidle = 0;
sevseg.setBrightness(LEDdefault);
}
void displayidle() {
}
void countdn() {
// we debounce the button and decrease the presses
if (millis() - time > debounce) presses--;
time = millis();
buttonidle = 0;
sevseg.setBrightness(LEDdefault);
}
returns this error code
Arduino: 1.6.7 (Windows 10), Board: "Arduino/Genuino Uno"
Board breadboard:avr:atmega328bb doesn't define a 'build.board' preference. Auto-set to: AVR_ATMEGA328BB
PCEngine_BRAM_pager:38: error: 'sevseg' does not name a type
sevseg.begin(COMMON_ANODE, numDigits, digitPins, segmentPins);
^
PCEngine_BRAM_pager:40: error: 'sevseg' does not name a type
sevseg.setBrightness(LEDdefault); // set LED display
^
PCEngine_BRAM_pager:41: error: expected declaration before '}' token
}
^
exit status 1
'sevseg' does not name a type
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
I have rechecked, the file and the library are in the right place and even tried to use include from sketch menu to be sure I had the right one.
So why am I seeing this error when it was fine a few days ago?