Saturday, November 2, 2013

ULTRA SONIC SENSOR TO ARDUINO

Here you will get the information how to connect the ultra sonic sensor to the arduino platform


for pin discription see below the code.

/*

  distance sensor]
 VCC to arduino 5v GND to arduino GND
 Echo to Arduino pin 6 Trig to Arduino pin 7
 More info at: http://anildurgam.blogspot.in/


sponsred by the potentiallabs
visit us
http://potentiallabs.com/
http://potentiallabs.com/cart


 */

#define trigPin 5
#define echoPin 6

void setup() {
  Serial.begin (9600);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
}

void loop() {
  long duration, distance;
  digitalWrite(trigPin, LOW);  // Added this line
  delayMicroseconds(2); // Added this line

  digitalWrite(trigPin, HIGH);
//  delayMicroseconds(1000); - Removed this line
  delayMicroseconds(10); // Added this line
  digitalWrite(trigPin, LOW);
  duration = pulseIn(echoPin, HIGH);
  distance = (duration/2) / 29.1;
  if (distance >= 200 || distance <= 0){
    Serial.println("Out of range");
  }
  else {
    Serial.print(distance);
    Serial.println(" cm");
  }
  delay(500);
}


Connect the ultra sonic sensor...and done the work

MM32f103 led blink program

To work on mind motion MM32 microcontroller we need to install the keil uvision 5 version then install the mm32-link programmer go to li...