Show Posts
Pages: 1 ... 1885 1886 [1887] 1888 1889 ... 3067
28291  Using Arduino / Programming Questions / Re: Help! Tips on how to change the message an LCD using PushButton on: January 09, 2012, 08:43:27 am
Quote
guys anyone who knows how to do this tnx!
Yes. But for you to do it requires knowing which pin the switch is attached to, knowing which LCD you have, and knowing which text you want to display before and after the switch is pressed.
28292  Using Arduino / Programming Questions / Re: How to add a sound effects in Tone function? Please help!!! on: January 09, 2012, 08:28:43 am
Quote
Yes I understand the function of Tone and the pitches.h. but is there a way to put some sound effects such as reverb or chorus for the output
Apparently, then, you don't understand the Tone library. It is designed to play single notes - of a single frequency. Reverb and other sound effects don't work real well when you can only play a single frequency, do they?
28293  Using Arduino / Project Guidance / Re: Nano vs. Uno on: January 09, 2012, 08:20:36 am
http://arduino.cc/en/Main/ArduinoBoardNano
Quote
Overview

The Arduino Nano is a small, complete, and breadboard-friendly board based on the ATmega328 (Arduino Nano 3.0) or ATmega168 (Arduino Nano 2.x). It has more or less the same functionality of the Arduino Duemilanove, but in a different package. It lacks only a DC power jack, and works with a Mini-B USB cable instead of a standard one.
28294  Using Arduino / Programming Questions / Re: 2 Interrupts, 2 Pins, Simultaneous usage on: January 09, 2012, 08:15:13 am
Quote
Firstly: I did think my code should work, and I only wrote test code that output A or B to the serial monitor to see if the interrupts were triggered.
Serial.print() does not belong in an ISR. Period. Forget it.

Quote
I have no clue how to time A falling to B rising, I look to you for advice and guidance here.
How would you do it with a stopwatch? Start the watch going when the first event occurs. Stop when the second event occurs. The Arduino doesn't have a stopwatch that can be started and stopped, but it does have two functions that can record "now" when the interrupts occur. In the ISR, record the time and set a flag indicating that the interrupt occurred.

In loop(), see if both flags are set. If so, compute the time between the events and clear the flags.

Quote
I will quickly try and duplicate the code I wrote, since I do not have it anymore
Didn't save often enough?
28295  Using Arduino / Programming Questions / Re: 2 Interrupts, 2 Pins, Simultaneous usage on: January 09, 2012, 07:58:10 am
Quote
So what I thought would work was the following:

Attatchinterrupt(0,Starttimer,Falling); //A getting pulled low on pin 2
Attatchinterrupt(1,Stoptimer,Rising); //B rising on pin 3
Did you really think that would work? Did the compiler agree with you? I don't think so.

Regardless, what does your code really look like? Attaching two properly written interrupt handlers will not cause the Arduino to crash.
28296  Using Arduino / Programming Questions / Re: How i upload web page from sd card of ethernet shield w5100 for control leds? on: January 09, 2012, 07:54:37 am
You can't serve a dynamic page from static storage. You can serve the static parts of the page from the SD card, but the dynamic stuff must be served dynamically.
28297  Using Arduino / Programming Questions / Re: Help! About the use of ultrasonic sensor and servo motor on: January 09, 2012, 07:52:58 am
Code:
   for(byte angle = 0; angle <180 ; angle += 2)  // goes from 0 degrees to 180 degrees
  {                                        // in steps of 1 degree
Comments are nice. But they need to match the code.

Code:
    myservo.write(angle);
    ultrasonicsensor(angle);     // tell servo to go to angleition in variable 'angle'
    delay(30);    // waits 15ms for the servo to reach the angleition
You are sensing while the servo is still moving. You need to tell the servo to move, wait for it to get to the new position, then read the sensor.

Code:
int ultrasonicsensor(byte angle){
Why are you passing angle to this function? You never use it. Why are you returning a useless value from the function?

Code:
  for(byte angle = 180; angle > 0; angle-=2)     // goes from 180 degrees to 0 degrees
  {                               
    myservo.write(angle);
    delay(30);                           // waits 15ms for the servo to reach the angleition
  }
There is no reason to move back slowly. Get a move on. Just go to 0.
28298  Using Arduino / Storage / Re: how much size on eeprom on: January 09, 2012, 07:20:30 am
http://arduino.cc/en/Main/ArduinoBoardMega2560
Quote
EEPROM   4 KB
That's a upper case B (byte), not a lower case b (bit).
28299  Using Arduino / Programming Questions / Re: How i upload web page from sd card of ethernet shield w5100 for control leds? on: January 09, 2012, 07:12:08 am
Quote
Yes i want dynamic  web page...what javascript code i use for display web page the analog sensor value?
You need to design the web page you want to see on a PC using any web designer EXCEPT Front Page. Then, you make the Arduino serve up that page.

Your question is impossible to answer, since we have no idea what sensor values you want to display, or how you want them displayed.
28300  Using Arduino / Programming Questions / Re: Menu interface test fase on: January 09, 2012, 07:03:08 am
You need to post all of your code. Is UpDownCounter a value (how many times the up and down switches have been pressed? Or, is is a pin number? You are using it like a pin number, but the name implies that it is a counter.
28301  Using Arduino / Programming Questions / Re: Menu interface test fase on: January 09, 2012, 06:54:36 am
Quote
The counters work like this:

* Press Up (the UpDownCounter increments by 1)
* Press Down (the UpDownCounter decrements by 1)
* Press Enter (the EnterBackCounter increments by 1)
* Press Back (the EnterBackCounter decrements by 1)7

Code:
if ((digitalRead(UpDownCounter) == 0) && (digitalRead(EnterBackCounter) == 0))
  else if ((digitalRead(UpDownCounter) == 0) && (digitalRead(EnterBackCounter) == 1) && (digitalRead(enable1) == HIGH))
The pin number increments when you press the Up switch? That's a strange thing to do. Either that, or you shouldn't be reading from something that is not a pin number.
28302  Using Arduino / Programming Questions / Re: Speedometer calculation on: January 09, 2012, 06:49:56 am
Code:
int m;// variable to hold pulses
One letter global variable names are not recommended. How does one associate m with pulse count. Now, pulseCnt or pulseCount would be easy to associate with pulse count.

Along with PeterH's question (which is probably the crux of your problem), I'd ask what the currentMillis variable is for. It is local, so it isn't accessible outside of loop().

Generally, if you want to create a speedometer, you separate the counting of pulses from the sensor from the use of pulse count. That is most easily done by connecting the sensor to pin 2 or 3, and defining an interrupt service routine to be called when the sensor is triggered. That ISR then just counts pulses (in a properly named volatile global variable).

The loop() function then just keeps track of time, and periodically checks how many pulses have occurred, computes the speed, and resets the counter (not necessarily in that order). How often to check depends on what type of counter you are using (byte, int, long) and how long it takes that counter to overflow (you do not want that to ever happen).
28303  Using Arduino / Programming Questions / Re: Menu interface test fase on: January 09, 2012, 06:28:10 am
Code:
  if ((digitalRead(UpDownCounter) == 0) && (digitalRead(EnterBackCounter) == 0))
  else if ((digitalRead(UpDownCounter) == 0) && (digitalRead(EnterBackCounter) == 1) && (digitalRead(enable1) == HIGH))
Why are you reading the pins multiple times? Read them once. Serial.print() the pin state, so that you know that the switch is working properly.

You are not enabling the pullup resistors for the switch pins. This implies external resistors wired with the switches. Do you have these resistors? How ARE the switches wired?

Finally, what have you got against HIGH and LOW?
28304  Using Arduino / Project Guidance / Re: Send/receive data from iPhone to Arduino via VirtualWire on: January 09, 2012, 06:24:37 am
Code:
   char *msg=serInString[serOutIndx];
      vw_send((uint8_t *)serInString[serOutIndx], strlen(msg));//send one character message msg to receiver
You define a pointer, and point it at one character. You do this so you can determine the length of the one character string.

A string (what strlen expects as input) must be a NULL terminated array of characters, not a single character. Why you need to measure the length of a character is a mystery. Will it ever be other than 1?

Code:
  if(Serial.available()) {

    while (Serial.available()){

      sb = Serial.read();           

      serInString[serInIndx] = sb;

      serInIndx++;

    }

  }   
What is going to happen if there are 60 characters available on the serial port?

Code:
      vw_send((uint8_t *)serInString[serOutIndx], strlen(msg));//send one character message msg to receiver

      vw_send((uint8_t *)serInString[serOutIndx], 1);
Why are you sending the character twice? Why are you not sending the whole thing in one call?

You know its length (that is in serInIndx). Send the data in one call.
28305  Using Arduino / Project Guidance / Re: Motorcycle intercom project... feasible? on: January 09, 2012, 06:14:34 am
Quote
I would love to know if you guys think this is feasible or not.
First question. Did you see a microphone port on the Arduino? I wonder why not.
Second question. Did you see a speaker port on the Arduino? I wonder why not.

Actually, I know. The Arduino's ADC is too slow, and the Arduino hasn't enough memory, to do adequate analog (audio) to digital conversion. It's ability to convert the digital signal back to audio is also constrained.
Pages: 1 ... 1885 1886 [1887] 1888 1889 ... 3067