I’m trying to set up my stepper motor with my IR sensor and Uno board (attachment of the schematic) and keep coming across and error in my code and don’t know what to do. Help?
#include "Stepper.h"
#include "IRremote.h"
/*----- Variables, Pins -----*/
#define STEPS 32 // Number of steps per revolution of Internal shaft
int Steps2Take; // 2048 = 1 Revolution
int receiver = 6; // Signal Pin of IR receiver to Arduino Digital Pin 6
/*-----( Declare objects )-----*/
// Setup of proper sequencing for Motor Driver Pins
// In1, In2, In3, In4 in the sequence 1-3-2-4
Stepper small_stepper(STEPS, 8, 10, 9, 11);
IRrecv irrecv(receiver); // create instance of 'irrecv'
decode_results results; // create instance of 'decode_results'
void setup()
{
irrecv.enableIRIn(); // Start the receiver
}
void loop()
{
if (irrecv.decode(&results)) // have we received an IR signal?
{
switch(results.value)
{
case 0xFF629D: // UP button pressed
small_stepper.setSpeed(500); //Max seems to be 700
Steps2Take = 2048; // Rotate CW
small_stepper.step(Steps2Take);
delay(2000);
break;
case 0xFFA857: // DOWN button pressed
small_stepper.setSpeed(500);
Steps2Take = -2048; // Rotate CCW
small_stepper.step(Steps2Take);
break;
}
irrecv.resume(); // receive the next value
}
}/* --end main loop -- */
Here is the error that it gives
Arduino: 1.8.0 (Mac OS X), Board: “Arduino/Genuino Uno”
/Applications/Arduino.app/Contents/Java/libraries/RobotIRremote/src/IRremoteTools.cpp:5:16: error: ‘TKD2’ was not declared in this scope
int RECV_PIN = TKD2; // the pin the IR receiver is connected to
^
exit status 1
Error compiling for board Arduino/Genuino Uno.
This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.