Robot Art Show
Code
const int trigPin = 11; //connects to the trigger pin on the distance sensor
const int echoPin = 12; //connects to the echo pin on the distance sensor
const int buzzerPin = 10; //pin that will drive the buzzer
float distance = 0; //stores the distance measured by the distance sensor
void setup()
{
Serial.begin (9600); //set up a serial connection with the computer
pinMode(trigPin, OUTPUT); //the trigger pin will output pulses of electricity
pinMode(echoPin, INPUT); //the echo pin will measure the duration of pulses coming back from the distance sensor
pinMode(buzzerPin, OUTPUT); //set the buzzer pin to output
}
void loop()
{
distance = getDistance(); //variable to store the distance measured by the sensor Serial.print(distance); //print the distance that was measured Serial.println(" in"); //print units after the distance
if (distance <= 10) { //if the object is close
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
digitalWrite(3, LOW);
tone(buzzerPin, 272); //buzz the buzzer
pin delay(100); //wait 100 milliseconds
noTone(buzzerPin); //turn the buzzer off
delay(100); //wait 100 milliseconds
}
else if (10 < distance && distance < 20) { //if the object is a medium distance
digitalWrite(6, HIGH);
digitalWrite(5, LOW);
digitalWrite(3, LOW);
tone(buzzerPin, 272); //buzz the buzzer pin
delay(100); //wait 100 milliseconds
noTone(buzzerPin); //turn the buzzer off
delay(100); //wait 100 milliseconds
}
else { //if the object is far away
digitalWrite(3, HIGH);
digitalWrite(6, LOW);
digitalWrite(5, LOW);
tone(buzzerPin, 272); //buzz the buzzer pin
delay(100); //wait 100 milliseconds
noTone(buzzerPin); //turn the buzzer off
delay(100); //wait 100 milliseconds
}
delay(50); //delay 50ms between each reading }
V=ir
V=ir is a very good equation for filling in the blank when it comes to a circuit. If you have two of the components, this equation will allow you to find the third.
Current
The current is the speed in which the electricity moves around the circuit. Current is measured in amps.
Voltage
Voltage is the measure of the amount of electricity the battery is releasing. Voltage is measured in Volts.
Resistance
Resistance is the amount of resistance in a circuit or if specified, a resistor. Resistance is measured in Ohms.
Parallel
When a circuit is in parallel with another, the current will stay the same between them, but the voltage through each one will not.
Reflection
Two things I did well during this project were time management and communication. I practiced time management skills well during this project because we had to create our own schedule to get everything done. I managed my time well and I was able to get everything done on time. I worked on communication by communicating with teachers. During this project I would get stuck on a part and would have to reach out to the teachers for help.
Two things I need to work on are reviewing my work and getting right to work when I need to. I need to start reviewing my work more thoroughly because when I started to run my art show, there were many mistakes. I need to start reviewing it better so their are zero mistakes. The next thing I need to work on is getting right to work in the morning. I need to stop wasting time and get my work done early.