Show Posts
Pages: 1 ... 1889 1890 [1891] 1892 1893 ... 3072
28351  Using Arduino / Programming Questions / Re: 2 Interrupts, 2 Pins, Simultaneous usage on: January 09, 2012, 09:03:46 am
If you want to measure the time between interrupts, you need to record when they occur. If you don't, then there is no reason to disable/enable interrupts.

Quote
Could I then use millis() to calculate the time by noting when A is triggered and the again with B?
Try reading mromani's code again.
28352  Using Arduino / Programming Questions / Re: Help! Tips on how to change the message an LCD using PushButton on: January 09, 2012, 09:00:55 am
Quote
yah... i know how to that....the problem is i really wanna put a pushbutton to change those messages...
any tips?
Yes. Start by defining your requirements. Something like:
Before the switch is pressed, display "I'm not really dense" on the LCD.
While the switch is pressed, display "Yes, I am!" on the LCD.

Then, post the code that answers the questions I asked earlier, since you didn't answer them.
28353  Using Arduino / Networking, Protocols, and Devices / Re: Radio shack xbee kit, any good for$99? on: January 09, 2012, 08:54:30 am
It's the same package that sparkfun sells for $5 less.
http://www.sparkfun.com/products/9897
28354  Using Arduino / Programming Questions / Re: New to Arduino - Wanting to flash a led a few counts pause and few counts again on: January 09, 2012, 08:49:48 am
Quote
Is C++ the best way to go with Arduino or is C?
Absolutely!
28355  Using Arduino / Programming Questions / Re: 2 Interrupts, 2 Pins, Simultaneous usage on: January 09, 2012, 08:48:47 am
Quote
A quick try... (untested)
Aside from the obvious issue with the attachInterrupt function being misspelled, there is a potential problem with that code. The flags are byte sized, so access is atomic. The times are not, so access is not atomic. It will most likely be necessary to disable interrupts while reading the times and resetting the flags, and then re-enabling them as soon as possible. Otherwise the start and end flags and times may not be consistent.
28356  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.
28357  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?
28358  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.
28359  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?
28360  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.
28361  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.
28362  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.
28363  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).
28364  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.
28365  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.
Pages: 1 ... 1889 1890 [1891] 1892 1893 ... 3072