i am a noob and i have some code for my motors but i need help adding serial commands to it so i can transmit from one arduino to another for remote control of motors. could someone please help get me started in the right direction for both the transmitter and receiver, i would greatly appreciate the help.
#include <Stepper.h>
const int stepsPerRevolution = 64;
Stepper pan(stepsPerRevolution, 8,10,9,11);
Stepper tilt(stepsPerRevolution, 3,5,4,6);
void setup() {
pan.setSpeed(300);
tilt.setSpeed(300):
}
void loop() {
int sensorReading = analogRead(A0); // X-axis
if (sensorReading < 300) { pan.step(2); } // left
if (sensorReading > 800) { pan.step(-2); } // right
int sensorReading2 = analogRead(A1); // Y-axis
if (sensorReading2 < 300) { tilt.step(2); } // down
if (sensorReading2 > 800) { tilt.step(-2); } // up
}
thanks for your help