I have many external data to be inserted into an Arduino Motor Shield connected an Arduino One, is it possible?
How I can do it?
Thank you.
Is this related to your other Threads? I think you have three others already.
Please don't start a new Thread for the same project. You will get much better assistance ( a ) if you don't irritate people and { b ) if people have easy access to all the information about your project.
In this Thread your question seems to have no connection with your title.
Have you not already been advised not to use a motor shield with a stepper motor?
...R
i'm sorry i don't want to irritate anyone, however I would like to know how I can insert data from excel in my program. I found on the internet that i can use an array but i don't kown how to use it.
The program is this:
int motorPinDirA = 2;
int motorPinDirB = 8;
int motorPinPwmA = 3;
int motorPinPwmB = 9;
const int buttonPin = 6;
const int ledPin = 13;
int buttonState = 0;
char val = 0;
int delayTime = 2;
int myStep=1200;
int myStep1=200;
int myStep2=800;
int myStep3=600;
int mystep4=0;
void setup() {
pinMode(motorPinDirA, OUTPUT);
pinMode(motorPinDirB, OUTPUT);
pinMode(motorPinPwmA, OUTPUT);
pinMode(motorPinPwmB, OUTPUT);
pinMode(val,OUTPUT);
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
Serial.begin(9600);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
for (int i=1; i<=myStep; i++)
{
orario();
}
for (int i=1; i<=myStep; i++)
{
antiorario();
val = Serial.read();
}
for (int i=1; i<=myStep1; i++)
{
orario();
}
for (int i=1; i<=myStep1; i++)
{
antiorario();
val = Serial.read();
}
for (int i=1; i<=myStep2; i++)
{
orario();
}
for (int i=1; i<=myStep2; i++)
{
antiorario();
val = Serial.read();
}
for (int i=1; i<=myStep3; i++)
{
orario();
}
for (int i=1; i<=myStep3; i++)
{
antiorario();
val = Serial.read();
}
}
void orario()
{
digitalWrite(motorPinDirA, HIGH);
digitalWrite(motorPinDirB, LOW);
digitalWrite(motorPinPwmA, HIGH);
digitalWrite(motorPinPwmB, LOW);
delay(delayTime);
digitalWrite(motorPinDirA, LOW);
digitalWrite(motorPinDirB, HIGH);
digitalWrite(motorPinPwmA, LOW);
digitalWrite(motorPinPwmB, HIGH);
delay(delayTime);
digitalWrite(motorPinDirA, LOW);
digitalWrite(motorPinDirB, LOW);
digitalWrite(motorPinPwmA, HIGH);
digitalWrite(motorPinPwmB, LOW);
delay(delayTime);
digitalWrite(motorPinDirA, LOW);
digitalWrite(motorPinDirB, LOW);
digitalWrite(motorPinPwmA, LOW);
digitalWrite(motorPinPwmB, HIGH);
delay(delayTime);
}
void antiorario()
{
digitalWrite(motorPinDirA, LOW);
digitalWrite(motorPinDirB, LOW);
digitalWrite(motorPinPwmA, LOW);
digitalWrite(motorPinPwmB, HIGH);
delay(delayTime);
digitalWrite(motorPinDirA, LOW);
digitalWrite(motorPinDirB, LOW);
digitalWrite(motorPinPwmA, HIGH);
digitalWrite(motorPinPwmB, LOW);
delay(delayTime);
digitalWrite(motorPinDirA, LOW);
digitalWrite(motorPinDirB, HIGH);
digitalWrite(motorPinPwmA, LOW);
digitalWrite(motorPinPwmB, HIGH);
delay(delayTime);
digitalWrite(motorPinDirA, HIGH);
digitalWrite(motorPinDirB, LOW);
digitalWrite(motorPinPwmA, HIGH);
digitalWrite(motorPinPwmB, LOW);
delay(delayTime);
}
thank you
You need to breakdown your task into separate parts.
Communication from computer to Uno
Control of stepper from Uno
tackle each task on its own, when each is working combining them should be
more obvious.