Wednesday, May 28, 2014

ROBOcop #2

Step 1: materials
  • Robot built previously in project 3
  • Arduino Uno
  • Batteries
  • Sound Sensor 
  • 220 and 10K resistors
Step 2: Physical Building
  • I already had ROBOcop built so that was done
  • I started by adding wiring to make him make a noise when the sensor read motion.
 Step 3: Code

void setup() {
  Serial.begin(9600);
  Serial.println("Playing higher pitch tone...");
  pitch(3500); // pitch function call passes 3500 to Hz parameter
  delay(1000);
  Serial.println("Playing lower pitch tone...");
  pitch(2000); // pitch function call passes 2000 to Hz parameter
  delay(1000);
  }
 
void loop() {
}

void pitch(int Hz)
// pitch function with Hz declared as a parameter
{
Serial.print("Frequency = "); Serial.println(Hz);
tone(4, Hz, 1000); delay(1000);
}

Reflection

I couldn't get this project to work for some reason. I wish I did have more time to focus on at least getting it working. However, the process in building this was very fun and I regret nothing.

No comments:

Post a Comment