"Create awareness and bring an avenue where kids can learn the basics of electronics in order to build robotic and Internet of Things (IoT) gadgets"
Friday, June 23, 2017
Sunday, May 14, 2017
Saturday, March 18, 2017
Sunday, March 12, 2017
Expo By Robotics for Youth at Ashburn Library - Mar 18 (2pm)
Open for All
Date: March 18, 2017 2:00 pm
Venue: Ashburn Library, 43316 Hay Rd, Ashburn, VA 20147
Venue: Ashburn Library, 43316 Hay Rd, Ashburn, VA 20147
Expo By Robotics for Youth at Ashburn Library
Sunday, February 19, 2017
Servo Motor and Ultrasonic Sensor in Action - Toll Gate Project
Arduino Code:
#include <Servo.h>
int redLed = 13;
int triggerPin = 3;
int echoPin = 4;
int servoPin1 = 7;
int servoPin2 = 10;
int yellowLed = 2;
Servo myServo1;
Servo myServo2;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(redLed, OUTPUT);
pinMode(yellowLed, OUTPUT);
pinMode(triggerPin, OUTPUT);
pinMode(echoPin, INPUT);
myServo1.attach(servoPin1);
myServo2.attach(servoPin2);
}
void loop() {
// put your main code here, to run repeatedly:
long duration, distance;
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
Serial.print("Distance: ");
Serial.println(distance);
if (distance < 20) {
digitalWrite(redLed,LOW);
digitalWrite(yellowLed, HIGH);
myServo1.write(90);
myServo2.write(90);
}
else {
digitalWrite(redLed,HIGH);
digitalWrite(yellowLed, LOW);
myServo1.write(0);
myServo2.write(180);
}
}
Subscribe to:
Posts (Atom)