Description
In this lab we experimented with DC Motors and transitors to create motion. We hooked up a battery pack, DC motor, transistor, some resistors, and a polarity regulating diode to the Arduino, and later I hooked up my force sensor to be able to control the rate of rotational motion by pushing my fingers together. I think attached a drill bit to my DC motor and essentially created my own drill using the code provided by the instructor.
Components:
1- Arduino Uno Microcontroller
1- Breadboard
1- 220 Ω Resistors
1- 10k Resistor
1- Drill Bit
1- USB Cable
1- Force Sensor
1 - DC Motor
1 - Diode (1N4004)
1 - Transistor (TIP120)
2 - AA batteries
Code:
/*
* one pot fades one motor
* modified version of AnalogInput
int potPin = 0; // select the input pin for the potentiometer
int motorPin = 9; // select the pin for the Motor
int val = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin); // read the value from the sensor, between 0 - 1024
Serial.println(val);
analogWrite(motorPin, val/4); // analogWrite can be between 0-255
}
- Login to post comments