downloading program

I am trying to load a sketch and I get a message that says error compiling. I got the sketch off of youtube. It is used for a dust collection system in my wood shop.
Im new to this and have no idea what is wrong.
I know the board and software is ok because I can go to the blink program and change the intervals.
Hopefully someone can look at the sketch and tell me if it is missing something.

keypadToServo.ino_.zip (1.59 KB)

get a message that says error compiling.

That's not all it said, is it?

Post the error message(s)

Please post your code between [code][/code] tags.

Your code:

/*
This script was created by Bob Clagett for I Like To Make Stuff
For more projects, check out iliketomakestuff.com

Parts of this sketch were taken from the keypad and servo sample sketches that comes with the keypad and servo libraries.
*/


#include <ctype.h>
#include <Servo.h>
#include <Keypad.h>

const byte servoCount = 6;
const int OPEN_ALL = 100;
const int CLOSE_ALL = 99;
const int openPos = 165;
const int closedPos = 5;

static Servo servoList[servoCount];

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
// Define the keymaps.  The blank spot (lower left) is the space character.
char numberKeys[ROWS][COLS] = {
  { '1','2','3'   }
  ,
  { '4','5','6'   }
  ,
  { '7','8','9'   }
  ,
  { ' ','0','#'   }
};

byte rowPins[ROWS] = { 9,8,7,6 };
byte colPins[COLS] = { 12,11,10 }; 


// Create two new keypads, one is a number pad and the other is a letter pad.
Keypad numpad( makeKeymap(numberKeys), rowPins, colPins, sizeof(rowPins), sizeof(colPins) );

const byte ledPin = 13;                            // Use the LED on pin 13.

void setup() {
  Serial.begin(9600);
  pinMode(6, INPUT);
  pinMode(7, INPUT);
  pinMode(8, INPUT);
  pinMode(9, INPUT);
  pinMode(10, INPUT);
  pinMode(11, INPUT);
  pinMode(12, INPUT);

  pinMode(A0, OUTPUT);
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  pinMode(A4, OUTPUT);
  pinMode(A5, OUTPUT);
  
  numpad.begin( makeKeymap(numberKeys) );
  numpad.addEventListener(keypadEvent_num);  // Add an event listener.
  numpad.setHoldTime(500);                   // Default is 1000mS
  
  servoList[0].attach(A0);
  servoList[1].attach(A1);
  servoList[2].attach(A2);
  servoList[3].attach(A3);
  servoList[4].attach(A4);
  servoList[5].attach(A5);
  
 // setServoState(CLOSE_ALL); //reset all servos
}

char key;
static char virtKey = NO_KEY;      // Stores the last virtual key press. (Alpha keys only)
static char physKey = NO_KEY;      // Stores the last physical key press. (Alpha keys only)
static char buildStr[12];
static byte buildCount;
static byte pressCount;
static byte kpadState;

void loop() {
  key = numpad.getKey( );
}

// Take care of some special events.
void setServoState(char number) {
  int thisServ = 0;
  int val;
  boolean ignoreAll = false;
  switch (number){
  case '1':
    val = 0;
    break;
  case '2':
    val = 1;
    break;
  case '3':
    val = 2;
    break;
  case '4':
    val = 3;
    break;
  case '5':
    val = 4;
    break;
  case '6':
    val = 5;
    break;
  case '7':
  case '8':
  case '9':
    ignoreAll = true;
    break;
  default:
    val=number;
    break;
  }
  if(!ignoreAll){
    for(thisServ = 0; thisServ < servoCount; thisServ += 1){
      int newPos = 0;
      if(thisServ == val or val == OPEN_ALL){
        newPos = openPos;
      } 
      else {
        newPos = closedPos;
      }
      servoList[thisServ].write(newPos);
    }
  }
}

void keypadEvent_num( KeypadEvent key ) {
  // in here when using number keypad
  kpadState = numpad.getState();
  swOnState( key );

} // end numbers keypad events

void swOnState( char key ) {
  Serial.print("key = ");
  Serial.print(key);
  Serial.println();

  switch( kpadState ) {
  case PRESSED:

    if (isdigit(key) || key == ' ' || key == '.'){
      setServoState(key);
    }
    if (key == '#') {
      Serial.print("CLOSE ALL");
      Serial.println();
      setServoState(CLOSE_ALL);
    }
    if (key == ' ') {
      Serial.print("OPEN ALL");
      Serial.println();
      setServoState(OPEN_ALL);
    }
    break;
  case HOLD:
    if (key == '#')  {               // Toggle between keymaps.
    }
    else  {                          // Some key other than '#' was pressed.

    }
    break;

  case RELEASED:
    break;
  }  // end switch-case
}// end switch on state function

The error messages when I try to compile it:

Binary sketch size: 6,154 bytes (of a 30,720 byte maximum)

That is the "error" most people expect.

that is all it said. I am trying to download the program, but do not he wiring done yet.have

I just tried it again. It says,
Compilation terminated.
Exit status 1
error compiling

Are you sure if you scroll up in the error window there is not a message saying something like fatal error keypad.h ....

If so you need to install the keypad library you are referencing with the #keypad.h line

I copied and pasted this from the error message.
Arduino: 1.6.7 (Windows 7), Board: "Arduino/Genuino Uno"

C:\Users\Owner\AppData\Local\Temp\Temp5_dust collector.zip\keypadToServo\keypadToServo.ino:11:20: fatal error: Keypad.h: No such file or directory

#include <Keypad.h>

^

compilation terminated.

exit status 1
Error compiling.

how do I fix it?

Sketch->Include Library->Manage Libraries... Then search for Keypad.

I couldnt find it

read this page and follow instructions for manually installing then

http://playground.arduino.cc/Code/Keypad

I still dont know what I am doing. Can ya rewrite the sketch with the keypad included and send it to me. I just dont understand it.

you need to add the library to the arduino programming interface.
Sketch->Include Library->Manage Libraries... Then search for Keypad.

i just searched and it is there. you must launch library manager then put keypad in search within library manager.

the code compiles does not need rewritten

Thank you very much. I got it to load. I was beginning to think it was a waste of money

cool glad I could help, feel free to add karma to my profile :slight_smile: