Show Posts
Pages: 1 ... 2262 2263 [2264] 2265 2266 ... 3267
33946  Using Arduino / Programming Questions / Re: portOutputRegister() on: October 19, 2011, 05:41:11 am
where is portOutputRegister defined
In pins_arduino.h:
#define portOutputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_output_PGM + (P))) )

is there a better technique for finding a symbol that is defined in some included file rather than just opening and examining each included file?
On Windows there is. Don't know about Macs, but I presume there must be.
33947  Using Arduino / Programming Questions / Re: don't want loop rather a state change on: October 19, 2011, 05:36:40 am
The Tools + Auto Format menu item might be of interest. It would make your code a lot neater looking. The random indents and outdents make it hard to follow.
33948  Using Arduino / Programming Questions / Re: Problem with password checker and messages on lcd on: October 19, 2011, 05:29:50 am
     if (password.evaluate()){
       lcd.begin(16, 2);
  lcd.print("CORRECT PASSWORD ");
What happened? Did your LCD change size? Why are you calling lcd.begin() again?
33949  Using Arduino / Programming Questions / Re: Problem with a char array on: October 19, 2011, 05:21:57 am
The LCDPutStr library routines requires a pointer to the beginning of the string.
So, create one that points to the start of the array. Then, increment it to walk through the array. When it points to the right place in the array, call LCDPutStr. Or just offset it to the correct location.

Actually, pointers and arrays are very closely linked. I'd be surprised if you couldn't just pass it something like &text[n], where n is the start of the data you want to show.
33950  Using Arduino / Programming Questions / Re: Problem with a char array on: October 19, 2011, 05:19:40 am
With the change, the compiler knows the size of the array and can set it up before execution. Does this make sense?
Yes, it does. The calculation for maxNumberChars is not done at compile time. It is done at run time. The space for the array is allocated at compile time. Since maxNumberChars at compile time contains a 0, the array size is pretty small.

If maxNumberChars were a #define, as maxNumberLines and maxLineLength are, I think the compiler would kick out an error message, or at least a warning, although warnings are suppressed, so you'd never see it.
33951  Using Arduino / Networking, Protocols, and Devices / Re: Data over XBee works for a few seconds then stops... on: October 19, 2011, 04:58:42 am
I tried my test again at different speeds. The only speed that worked was 9600 baud.
33952  Using Arduino / Programming Questions / Re: WiShield + Uno = can't retrieve webpage using sample PDE (code included) on: October 19, 2011, 04:37:57 am
In void setup, I think printData is called in this line:

No. That line defines which function to call when data is returned. It does not actually call any function.

You need to add a Serial.print() statement in the printData() function to confirm that it is actually called.

Also, which line were you referring to when you mentioned that was a "strange way to traverse a pointer"?
This code:
  while (len-- > 0) {
I'd have used something like:
for(int i=0; i<len; i++)
Much more obvious what is happening, and the pointer is not mucked with.
33953  Using Arduino / Programming Questions / Re: I need help capturing GPS data using NewSoftSerial. on: October 19, 2011, 04:32:28 am
  pinMode(rxGPSpin, INPUT);
  pinMode(txGPSpin, OUTPUT);
You told the NewSoftSerial object that these were it's pins. Why are you messing with them?

I get recognizable NMEA strings when I take out the ATMega chip and read the GPS data right into the serial monitor
Without the chip, the data is not being inverted. With the sketch running,
NewSoftSerial GPSSerial(rxGPSpin, txGPSpin, true);
says to invert it.

33954  Using Arduino / Programming Questions / Re: Getting reliable's without a stop character on: October 19, 2011, 04:21:16 am
    //let's get rid of all that other data in case the buffer still has some left in it.

    //write over the command space so we don't see previous characters
    //for a shorter command next time
    for (int i = 0; i < sizeof(command); i++)
      command[i] = 0;
Lovely. Insert NULLS in every position because you don't understand what NULL-terminated means.

How fast does loop() operate? Let's assume that no serial data is sent.
1) Check for serial data (Serial.available() gets called. It computes and returns the difference between two pointers - two uint8_t accesses and a subtraction operation).
2) Compare the result to 0. It's not greater, so
3) Decrement tries (an int access, a subtract, and an int store)
4) Another if test with an int access, a compare, a byte access and another compare
How long do you think this will take to execute? I'll wait while you figure it out. Remember the Arduino operates at 16MHz, so each operation takes 62.5 nanoseconds.

As one person mentioned before, adding the delay is a "band-aid" solution to the problem. Here's a way I found that will prevent that reliably, though it may still be seen as a crutch to the program.
It is.
33955  Using Arduino / Programming Questions / Re: WiShield + Uno = can't retrieve webpage using sample PDE (code included) on: October 18, 2011, 06:55:19 pm
The first thing that you should want to know is whether printData() is even being called.

That is a very strange way to traverse a pointer when you already know the length.
33956  Using Arduino / Project Guidance / Re: Blinking LEDS with motion sensor on: October 18, 2011, 06:15:59 pm
You are getting a distance from the sensor.
You are blinking the LED at a fixed rate.

Seems to me like you want to change the fixed rate to a variable rate that is a function of the distance.

What that function looks like, only you know.
33957  Using Arduino / Interfacing w/ Software on the Computer / Re: interfacing arduino with processing and maxmsp at the same time on: October 18, 2011, 06:04:56 pm
it seems that the communication port could not be shared by two programme
it can not.

is it possible?
33958  Using Arduino / Programming Questions / Re: Problem with a char array on: October 18, 2011, 05:59:31 pm
Are you compiling and linking this using the IDE? If so, why are you including all those include files that the IDE adds? Some of them, like avr/interrupts.h. I don't see that you need.
33959  Using Arduino / Project Guidance / Re: Automatic Daily Upload on: October 18, 2011, 03:19:54 pm
Forcing a sketch upload every day is not necessary. Create a process on the PC that connects to the serial port that the Arduino is on. That process should listen for a time sync request, and supply the current time.

Once an hour or so, the Arduino should ask for an updated time.
33960  Using Arduino / Project Guidance / Re: Using A0 to A5 as OUTPUT pins? on: October 18, 2011, 02:38:44 pm
I dont call pinMode on it do I?
Yes, you do.
Pages: 1 ... 2262 2263 [2264] 2265 2266 ... 3267