Skip to content

Instantly share code, notes, and snippets.

@lawm1991
Created November 11, 2013 17:05
Show Gist options
  • Save lawm1991/7416595 to your computer and use it in GitHub Desktop.
Save lawm1991/7416595 to your computer and use it in GitHub Desktop.
int ledPin = 12;
int inPin = 7;
int Button = 0;
int motorPin = 9;
int motorPin6 = 6;
int motorValue;
int motorValue6;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(inPin, INPUT);
pinMode(motorPin, OUTPUT);
pinMode(motorPin6, OUTPUT);
}
void loop(){
Button = digitalRead(inPin);
if (Button == HIGH) {
digitalWrite(ledPin, LOW);
motorValue = 0;
analogWrite(motorPin, motorValue);
motorValue6 = 0;
analogWrite(motorPin6, motorValue6);
}
if (Button == LOW) {
digitalWrite(ledPin, HIGH);
motorValue = 255;
analogWrite(motorPin, motorValue);
motorValue6 = 255;
analogWrite(motorPin6, motorValue6);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment