Show Posts
Pages: 1 ... 6 7 [8] 9 10 ... 23
106  Using Arduino / Programming Questions / Re: Ultrasonic Sensor on: July 06, 2013, 12:05:32 pm
I am using HC-SR04 smiley Okay, I should read the datasheets in more details then.

Thanks !
107  Using Arduino / Programming Questions / Re: Ultrasonic Sensor on: July 06, 2013, 11:38:14 am
And the minimum pulse length is 2 microseconds ? So means thet after 2 uS, the trigger pin will be trigger to send sonar ?

Thanks
108  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 smiley

Thanks smiley

By the way, why do we need the microsecond(2) in between when trigger LOW and HIGH ?

Thnaks
109  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
110  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 smiley-sad
111  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 ?
112  Using Arduino / Programming Questions / Ultrasonic Sensor on: July 06, 2013, 10:53:32 am
Code:
#define trigPin 9
#define echoPin 8


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(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 !
113  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 ! smiley
114  Using Arduino / Programming Questions / Re: DS1307 RTClib on: June 30, 2013, 04:08:21 am
Hey guys, wanna ask something regarding to DS1307 IC. I am using the RTClib. Okay, when I upload the sample coding to my arduino, the time will be set at the time the code being compile right ? So, if once done uploaded, then I re-compile again after like 5 minutes then upload, will the time been overwrite ? It seems to me not to be overwrite if I upload the same code with 'RTC.adjust(DateTime(__DATE__, __TIME__));' uncomment. If first time I uncomment that line and uploade to my arduino, then later on I upload again by commenting that line, then at maybe like after 10 minutes, I upload again the initialy code with 'RTC.adjust(DateTime(__DATE__, __TIME__));' uncomment, the time will change to the latest time I compile and upload the code. Can someone verify this to me ?

Thanks !
115  Using Arduino / Programming Questions / Re: DS1307 RTClib on: June 25, 2013, 03:13:17 am
Above mention library refer to Time.alarm ?
116  Using Arduino / Programming Questions / Re: DS1307 RTClib on: June 25, 2013, 02:50:53 am
How if I want to do something with delay when the alarm is ON ?

Thnaks
117  Using Arduino / Programming Questions / Re: DS1307 RTClib on: June 25, 2013, 02:28:58 am
So you mean I does not put any delay in the alarm function then ?

Thanks
118  Using Arduino / Programming Questions / Re: DS1307 RTClib on: June 25, 2013, 02:02:14 am
You mean while the alarm is on, I am not displaying the current time now ?

Thanks
119  Using Arduino / Programming Questions / Re: DS1307 RTClib on: June 25, 2013, 01:14:06 am
I am now trying to make alarm based on this rtclib. Any ideas ? Am still trying smiley

I just use an if

  if (hour == 0 && minute == 0 && second <2)
  {
  tralala;
           }

but I am only interested in changing the filename at midnight. If you want to do more sophisticated things there is an excellent pair of libraries, Time.h and TimeAlarms.h which seem to cover pretty well anything you can think of.

This can't work. If I were to add a delay(1000) in the alarm function, then initially, my seconds will be like this - 1,2,3,4,5......
If the alarm rang, means it is running the alarm functions and add on the delay(1000) too, so the seconds sequence would be 1,3,5,7,9

How to solve this ?

Thanks !

120  Using Arduino / Programming Questions / Re: DS1307 RTClib on: June 25, 2013, 12:40:50 am
How do I program it ? I am unsure about the function available in rtclib. Please guide smiley-sad
Pages: 1 ... 6 7 [8] 9 10 ... 23