Dmd changed by keypad

I'm only very new at this and was hoping someone on this forum could help me with this, I am aiming to be able to change the Dot Matrix Display to read out Numbers that are press on the 3x4 kepad but have come across some annoying errors that probably could be fixed really easyily but only be new at this i have no idea, the error is in bold at line 57.
thanks in advance.

error: expected primary-expression before '}' token
error: expected `;' before '}' token
error: 'key' was not declared in this scope
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <SPI.h>;        //SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include <DMD.h>;        //
#include <TimerOne.h>;   //
#include "SystemFont5x7.h";
#include "Arial14.h";
#include "Arial_black_16.h";
#include <Keypad.h>;

//Fire up the DMD library as dmd
#define DISPLAYS_ACROSS 1
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);
const byte ROWS = 4; //four rows
const byte COLS = 3; //three col

/*--------------------------------------------------------------------------------------
  Interrupt handler for Timer1 (TimerOne) driven DMD refresh scanning, this gets
  called at the period set in Timer1.initialize();
--------------------------------------------------------------------------------------*/
void ScanDMD()
{ 
  dmd.scanDisplayBySPI();
}

/*--------------------------------------------------------------------------------------
  setup
  Called by the Arduino architecture before the main loop begins
--------------------------------------------------------------------------------------*/


//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
byte rowPins[ROWS] = {1, A2, A3, A5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {2, 0, A4}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 
void loop()
{
   //initialize TimerOne's interrupt/CPU usage used to scan and refresh the display
   Timer1.initialize( 5000 );           //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
   Timer1.attachInterrupt( ScanDMD );   //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()

   //clear/init the DMD pixels held in RAM
   dmd.clearScreen( true );   //true is normal (all pixels off), false is negative (all pixels on)
{
   byte a;
   
   // 10 x 14 font clock, including demo of OR and NOR modes for pixels so that the flashing colon can be overlayed
   dmd.clearScreen( true );
   dmd.selectFont(Arial_14);
}
void loop();
{
  char key = Kpd.getKey();
  if(key)  // Check for a valid key.
}
  {
    switch (key)
    {
      case '1':
        digitalWrite(dmd.drawChar(  0,  3, '1', GRAPHICS_NORMAL ));
        break;
      case '2':
        digitalWrite(dmd.drawChar(  5,  3, '2', GRAPHICS_NORMAL ));
        break;
      default:
        Serial.println(key);
    }
  
 }

}
Last edited on
get rid of line 51 and 62 idk what you were trying to do... Also next time you should list the lines makes it easier but luckily you have them indented so it was easy to spot.

I see more errors though line 58 does nothing because of semicolon and anyways you declared a function named that already..

Other than that I have no idea what dmd and spi are is that some sort of numpad?
Hey Giblit
Thanks for that I'll redo that
A DMD is a Display and yes it is a Numpad

as i said i have no idea what I'm doing haha
Last edited on
Topic archived. No new replies allowed.