Got compiler error when I checked program.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows NT (unknown)), Board: "Arduino Micro"
sketch_nov10a:57: error: 'Encoder' does not name a type
sketch_nov10a.ino: In function 'void loop()':
sketch_nov10a:82: error: 'myEnc' was not declared in this scope

This is the code:

#include <Encoder.h>
// Encoder lib found here: 
// https://github.com/dc42/arduino/tree/master/Libraries/RotaryEncoder

// "Jog Controller" - CNCSimulator Pro Arduino Sketch for manual jog of the CNC axis
// Made for Arduino JoyStick Module and Rotary encoder.
// Press the center button to switch between input modes (X,Y,Z,XY,STEP etc.)
// Move joystick to jog axis or change step (depending on mode)
// Long press to set all axis to zero and generate G92 code.

// This code is provided free of charge and should be considered an experimental prototype.
// Optimize for own hardware as well as customized functionality.

// Commands to send to the CNCSimulator.
// ST+ or ST- = STEP+ and STEP- Rotary encoder increase/decrease
// J[PotH]:[PotV] Joystick Potentiometer values, both range from -100 to 100
// CJM Cycle Jog Mode - Joystick center button was pressed, cycles Jog mode settings
// SZP Joystick center button was long pressed (1 sec). Sets zero point
// JMX Jog Mode X  (unused here, we use CJM instead)
// JMY Jog Mode Y  (unused here, we use CJM instead)
// JMZ Jog Mode Z  (unused here, we use CJM instead)
// JXY Jog Mode XY  (unused here, we use CJM instead)
// STP Step Mode   (unused here, we use CJM instead)
// ETL Embedded Tool (unused here, we use CJM instead)

// Commands to receive from the CNCSimulator
// @R Simulator is running  (Red LED)
// @P Simulator has paused  (Yellow LED)
// @S Simulator has stopped (Green LED)
// @E Simulation error (Red and green LEDs)
// @C Cycle leds
// @O All LEDs off


#define joyPin1 0               // slider variable connected to analog pin 0
#define joyPin2 1               // slider variable connected to analog pin 1
#define redLedPin 8
#define yelLedPin 9
#define greenLedPin 10
#define button1Pin 0            // joystick center button
#define encoderPin1 2
#define encoderPin2 3
#define blinkdelay 50

int value1 = 0;                 // variable to read the value from the analog pin 0
int value2 = 0;                 // variable to read the value from the analog pin 1
int button1state; 
int btnval1;
int btnval2;                    // used to debounce buttons
boolean waitingForCmd = false;
int Counter = 0;
const int JoyStickDeadZone = 10;

volatile long encoderValue = 0;
long lastencoderValue = 0;

Encoder myEnc(encoderPin1, encoderPin2);

// Note: The Keyes Rot. Encoder is a bit bouncy with this sketch.
// Code changes or hardware debouncing might be needed.

void setup() 
{
  // Setup pin modes
  pinMode(button1Pin, INPUT);
  pinMode(redLedPin, OUTPUT);
  pinMode(yelLedPin, OUTPUT);
  pinMode(greenLedPin, OUTPUT);
  pinMode(encoderPin1, INPUT_PULLUP); 
  pinMode(encoderPin2, INPUT_PULLUP);

  Serial.begin(115200);
  button1state = digitalRead(button1Pin);

  // Do a little initial blink with the LEDs to signal wakeup
  cycleLEDs();
}

void loop() 
{
  // Rotary encoder part
  if((encoderValue =myEnc.read())!=lastencoderValue)
  {   
    if(encoderValue > lastencoderValue)
      Serial.println("ST+");
    else
      Serial.println("ST-");
    lastencoderValue = encoderValue;
  }

  // Joystick part
  if(Counter == 1)
    value1 = map(analogRead(joyPin1), 0,1023,-100,100);
  else if(Counter == 2)
    value2 = map(analogRead(joyPin2), 0,1023,-100,100);
    
  if(value1 < -JoyStickDeadZone || 
    value1 > JoyStickDeadZone || 
    value2 < -JoyStickDeadZone || 
    value2 > JoyStickDeadZone)
  {
    // joystick is off center, notify the CNCSimulator
    Serial.print('J');
    if(value1 < -5 || value1 > 5)
      Serial.print(value1);
    else
      Serial.print(0);
    Serial.print(':');
    if(value2 < -5 || value2 > 5)
      Serial.println(value2);
    else
      Serial.println(0);
  }
  else
  {
    btnval1 = digitalRead(button1Pin);
    delay(10);
    btnval2 = digitalRead(button1Pin);
    if(btnval1==btnval2)
      if(btnval1 != button1state)
      {        
        button1state = btnval1;
        if(btnval1 == LOW)
        {
          // Button 1 is pressed
          unsigned long timeStart = millis();
          while(digitalRead(button1Pin)==LOW)  // Wait for it to become released
            if(millis()-timeStart > 1000) // Long press
            {             
              Serial.println("SZP");
              return;
            }           
          Serial.println("CJM");
          delay(50);
        }
      }
  }

  Counter++;
  if(Counter==3)
    Counter = 1;

  delay(80);  // delay needed between analog reads

  // Receive commands from the CNCSimulator
  if(Serial.available() > 0)
  {
    char data = Serial.read();
    if(waitingForCmd)    
      doOneByteCmd(data);
    else if(data == '@')  // one byte command on its way
    {
      if(Serial.available()> 0)
        doOneByteCmd(Serial.read());
      else
        waitingForCmd = true;      
    }
  }
}

void doOneByteCmd(char cmd)
{
  waitingForCmd = false;

  if(cmd == 'R')  // Running
    setLEDs(true, false, false);
  else if(cmd=='P')  // Paused
    setLEDs(false, true, false);
  else if(cmd=='S')  // Stopped
    setLEDs(false, false, true);
  else if(cmd=='E')  // Error (Red + Green)
    setLEDs(true, false, true);
  else if(cmd=='O')  // All LEDs off
    setLEDs(false, false, false);
  else if(cmd=='C') // Cycle LEDs
    cycleLEDs();
}

void cycleLEDs()
{
  setLEDs(false, false, false);

  for(int l = 0; l<3; l++)
  {
    setLEDs(true, false, false);
    delay(blinkdelay);
    setLEDs(true, true, false);
    delay(blinkdelay);
    setLEDs(true, true, true);
    delay(blinkdelay);
    setLEDs(false, true, true);
    delay(blinkdelay);
    setLEDs(false, false, true);
    delay(blinkdelay);
    setLEDs(false, false, false);
    delay(blinkdelay);
  }
}

void setLEDs(bool red, bool yellow, bool green)
{
  digitalWrite(redLedPin, red);
  digitalWrite(yelLedPin, yellow);
  digitalWrite(greenLedPin, green);
}
#include <Encoder.h>

Where did you put the library? Did you restart the IDE after you put it there?

I was told that I need to download the library at:
https://www.pjrc.com/teensy/td_libs_Encoder.html

Where should I put the library?

The code has notes that tell me to get the encoder library here:

Not sure which one to get and where to put it.
When I click on the link above it's the source code, but I'm not sure what to name it and where to put it so it will run with the program.

Read this:-

The code has notes that tell me to get the encoder library here:

What code does? Nothing on the pjrc site tells you to go to github to get anything.

It said in the original code 2nd and third line:

#include <Encoder.h>
// Encoder lib found here:
// arduino/Libraries/RotaryEncoder at master · dc42/arduino · GitHub

I went to that link just didn't know what to do from there. I'm going to try the link Grumpy_Mike suggested:

I can't seem to get it to work.

The instructions for this project are found here:
http://cncsimulator.info/blog/

May 13, 2014 blog entry

I can't seem to get it to work.

I downloaded the library from the pjrc site, installed it in the right place (you did not define where you installed the library, so I won't either), copied and pasted your code into the IDE, and got just one "error":

Binary sketch size: 8,794 bytes (of a 28,672 byte maximum)

I just followed these directions when I installed the library from the pjrc site.

In the serial monitor I see my jog stick and rotary encoder read values when I move it.
Just in the CNCSimulator program it doesn't work. I emailed the CNCSimulator company to see what the problem is.

I didn't get any errors when I compiled and move it to my Arduino Micro.

Anybody have any ideas?
Serial Monitor shows my jog wheel and Joystick working, but it won't work with the cncsimulator program.

Anybody have any ideas?
Serial Monitor shows my jog wheel and Joystick working, but it won't work with the cncsimulator program.

I do. Perhaps you should tell us what CNC simulator program you are talking about.

I'm using this porgram:

http://cncsimulator.info/blog/

I built the job and encoder thing mentioned in the blog. The owner of the program told me it's something in their code that is not communicating with the Arduino setup. I was able to get readings from serial monitor so it's something they have to fix. I think that's where we stand now. If you happen to see something in the code in my original post that needs to be fixed let me know.

Thanks,
Mark