I am using Codeblocks with arduino IDE to simulate the control of a stepper motor, and the errors "'analogRead' was not declared in this scope" and "'A0' was not declared in this scope" keep popping. The code follows:
#include <Stepper.h>
const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
int stepCount = 0; // number of steps the motor has taken
void setup() {
}
void loop()
{
int sensorReading = analogRead(A0); //ERROR
int motorSpeed = map(sensorReading, 0, 1023, 0, 100);
if (motorSpeed > 0)
{
myStepper.setSpeed(motorSpeed);
myStepper.step(stepsPerRevolution / 100);
}
}
EDIT: Sorry I forgot to mention it clear, but I do not own a board, that's why I'm trying to simulate it on PC.