Created
November 11, 2013 17:05
-
-
Save lawm1991/7416595 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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