I am new to all this. I want to run two dc motors but I want to start them after I press button btn1 and stop after btn2 is pressed.
This is my first try.
#include <MotorShield.h>
// the setup routine runs once when you press reset:
void setup()
{
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop()
{
// read the input pin:
int buttonState = readButton(btn1);
// print out the state of the button:
Serial.println(buttonState);
delay(1); // delay in between reads for stability
}
Question
joesanford
I am new to all this. I want to run two dc motors but I want to start them after I press button btn1 and stop after btn2 is pressed.
This is my first try.
#include <MotorShield.h>
// the setup routine runs once when you press reset:
void setup()
{
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
// the loop routine runs over and over again forever:
void loop()
{
// read the input pin:
int buttonState = readButton(btn1);
// print out the state of the button:
Serial.println(buttonState);
delay(1); // delay in between reads for stability
}
it doesn't like bnt or readButton.
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.