| Arduino Forum ::  Members :: Vincent19
 Show Posts Pages: 1 ... 6 7 [8] 9 10 ... 23
 106 Using Arduino / Programming Questions / Re: Ultrasonic Sensor on: July 06, 2013, 11:33:48 am Okay, will take some time to do the math tricks here Thanks By the way, why do we need the microsecond(2) in between when trigger LOW and HIGH ?Thnaks
 107 Using Arduino / Programming Questions / Re: Ultrasonic Sensor on: July 06, 2013, 11:29:23 am Ok to be clear, why should I divide by 20000 ?Thanks
 108 Using Arduino / Programming Questions / Re: Ultrasonic Sensor on: July 06, 2013, 11:26:51 am How did I convert it ? I just get myself too confused with that
 109 Using Arduino / Programming Questions / Re: Ultrasonic Sensor on: July 06, 2013, 11:14:56 am Okay, now I am suck in the unit conversion. Get confused although I know the facts LOL.Anyone ?
 110 Using Arduino / Programming Questions / Ultrasonic Sensor on: July 06, 2013, 10:53:32 am Code:#define trigPin 9#define echoPin 8void 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(10); // Added this line  digitalWrite(trigPin, LOW);  duration = pulseIn(echoPin, HIGH);  distance = duration*340 / 20000;        Serial.print(distance);    Serial.println(" cm");    delay(500);  }  Hey guys, this is the code that I get somewhere else online.Can anyone try to explain to me why is the calculation for distance is such ? I understand that thius is the formula for distance  = time* velocity. How does that 20000 comes from ? I know that the distance that we interest in have to be divided by 2. So I guesse there is where the 2 comes from but why multiple 10 power of 4 ?Thanks !
 111 Using Arduino / Project Guidance / Creating my own TV remote control on: June 30, 2013, 01:20:11 pm Hey guys, recently I am playing around with the IR sensor used in television. So, I deal with the TV remote control. I would like to ask that how am I able to make my custom remote control ? I need encoder IC ? Or how can I do it instead of using those ready-made remote control ?Thanks for help !