Andres Rodriguez
Created March 24, 2023

Project 09 - DIG3602C

Andres Rodriguez UCF-Spring2023-DIG3602C-Davis Project 09:

Showcase (no instructions)3
Project 09 - DIG3602C

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
Jumper wires (generic)
Jumper wires (generic)
×1
DC Motor, Miniature
DC Motor, Miniature
×1
9V battery (generic)
9V battery (generic)
×1
PTS 645 Series Switch
C&K Switches PTS 645 Series Switch
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Power MOSFET N-Channel
Power MOSFET N-Channel
×1
1N4007 – High Voltage, High Current Rated Diode
1N4007 – High Voltage, High Current Rated Diode
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Project 09 Breadboard

Project 09 Schematics

Code

Project 09 Code

Arduino
const int switchPin = 2;
const int motorPin = 9;
int switchState = 0;
void setup() {
pinMode(motorPin, OUTPUT);  // put your setup code here, to run once:
pinMode(motorPin, INPUT); 
}
void loop() {
switchState = digitalRead(switchPin);  // put your main code here, to run repeatedly:
if (switchState == HIGH) {
  digitalWrite(motorPin, HIGH);
}
else {
  digitalWrite(motorPin, LOW); 
 }
}

Credits

Andres Rodriguez
12 projects • 1 follower

Comments