Professional Documents
Culture Documents
Prototype Overview
(Please add figure of the computer system and explain how your computer system
works. Identify the components of the computer system (input, output, process,
memory and communication)
VarSpeedServo servo1;
void setup() {
Serial.begin(9600);
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);
servo1.attach(servo1Pin);
servo1.write(0);
void loop () {
long duration,distance;
digitalWrite(trigPin,HIGH);
delayMicroseconds(1000);
digitalWrite(trigPin,LOW);
duration = pulseIn(echoPin,HIGH);
distance = (duration/2)/29.1;
Serial.print(distance);
Serial.println("CM");
delay (1);
if (distance <=10)
servo1.write(90);
else{
servo1.write(10,300,true);
delay(10);