Shield V5 0 Manual: Arduino Sensor

void setup() Serial.begin(9600); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); myservo.attach(10); // Servo is on pin 10 (SERVO1)

// Sweep back for (pos = 180; pos >= 0; pos--) myservo.write(pos); delay(15); int distance = readUltrasonic(); Serial.print("Angle: "); Serial.print(pos); Serial.print(" cm: "); Serial.println(distance); arduino sensor shield v5 0 manual

The reset button on the shield should align perfectly with the reset button on the Arduino. The USB port on the Arduino should stick out the "short side" of the shield. void setup() Serial

Enter the . This expansion board (or "shield") is designed to solve exactly this problem. It turns your messy breadboard into a clean, plug-and-play hub for sensors and servos. This expansion board (or "shield") is designed to

int readUltrasonic() digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); long duration = pulseIn(echoPin, HIGH); int distance = duration * 0.034 / 2; return distance;