21 lines
446 B
Arduino
21 lines
446 B
Arduino
|
int pushButton = 2;
|
||
|
|
||
|
// the transistor which controls the motor will be attached to digital pin 9
|
||
|
int motorControl = 3;
|
||
|
|
||
|
// the setup routine runs once when you press reset:
|
||
|
void setup() {
|
||
|
// make the pushbutton's pin an input:
|
||
|
pinMode(pushButton, INPUT);
|
||
|
|
||
|
// make the transistor's pin an output:
|
||
|
pinMode(motorControl, OUTPUT);
|
||
|
}
|
||
|
|
||
|
// the loop routine runs over and over again forever:
|
||
|
void loop() {
|
||
|
|
||
|
analogWrite(motorControl, 0);
|
||
|
|
||
|
}
|