Show Posts
Pages: 1 ... 130 131 [132] 133 134 ... 244
1966  Using Arduino / Programming Questions / Re: Mobile for my baby son on: November 12, 2012, 04:36:33 pm
Classic error made by most everyone who has ever tried to code in C:

This
Code:
if (buttonpress = 0)

Should be this:
Code:
if (buttonpress == 0)

Same error is copied and pasted throughout the function.
1967  Using Arduino / Programming Questions / Re: Serial.println inside an interrupt fails on: November 11, 2012, 08:26:14 am
Search the forum for interrupt and serial.print. The distilled wisdom you'll find is - "just say no". Serial comms are slow - putting anything slow in an interrupt routine is asking for trouble.
1968  Using Arduino / Programming Questions / Re: How to read RFID info? on: November 11, 2012, 07:15:23 am
Quote
I tried the sample code with the module's TX pin connected to the Arduino's TX pin

That doesn't sound good, unless it's a typo. TX needs to be connected to RX and vice versa. But as Grumpy_Mike points out, if you want to emit the data so you can read it over a serial port as well, you're going to need two.
1969  Using Arduino / Programming Questions / Re: Button logic on: November 08, 2012, 04:32:17 pm
Quote
Maybe I should just put in a switch and be done with it
Switch, button doesn't matter - anything that involves making and breaking a circuit using  mechanical contacts will bounce.
1970  Using Arduino / Programming Questions / Re: Running out of memory - suggestions? on: November 08, 2012, 01:35:52 pm
From this page: http://www.arduino.cc/playground/Main/Printf

Quote
Using Flash Memory for string storage

Version 1.0 of the Arduino IDE introduced the F() syntax for storing strings in flash memory rather than RAM. e.g.

Serial.println(F("This string will be stored in flash memory"));

Another thing to consider is how much SRAM those libraries are consuming.

Finally, I notice that currentMillis is never used, although you assign to it. I'm not sure if the compiler is smart enough to drop the declaration. Do you perhaps have others that are (currently) unused?
1971  Using Arduino / Programming Questions / Re: Is there another way to do a DigitalWrite? on: November 08, 2012, 01:21:01 pm
You can, as Udo Klein's link demonstrates, but unless you really need the speed or to save memory, why do you want to? Generally, code that doesn't use port manipulation is easier to read.
1972  Using Arduino / Programming Questions / Re: Serial Streaming question on: October 26, 2012, 06:47:55 pm
Quote
If I'm not mistaken each element of the array would be 2 bytes
You're mistaken - char is a single byte. Even though I think I know what your latest code is, please post the version that fails at 258.
1973  Using Arduino / Programming Questions / Re: Photo Resistor question on: October 26, 2012, 04:21:50 pm
Deleting it does no harm as AWOL remarked, but don't forget it's existance - Serial.print and Serial.println are your primary weapons for debugging your sketches. You will be needing them before long I suspect.
1974  Using Arduino / Programming Questions / Re: Serial Streaming question on: October 26, 2012, 12:23:06 pm
Move index=0; up inside the inner if.
1975  Using Arduino / Programming Questions / Re: There is a better and quickly way to read a .txt file, find a Match string ? on: October 26, 2012, 11:47:15 am
You could use a hashing system to produce a filename which contains all numbers that have that hash and choose a hashing algorithm that gives you your desired granularity. At it's simplest, you could just take the last digit of the number & store all numbers that end in (for example) 0 in "0.txt". Choose two (or more digits to further reduce the number of entries in each file.

Can you give a bit more detail about what your system as a whole is going to do?
1976  Using Arduino / Programming Questions / Re: Start and Stop Stepper with Accel Library on: October 25, 2012, 08:39:00 am
What Nick is asking is that you post (in it's entireity) the latest sketch that you're having problems with. It's too hard to help if we're guessing what you changed.
1977  Using Arduino / Programming Questions / Re: warning: internal error: out of range error on: October 24, 2012, 06:34:12 pm
18,000 lines of code in an arduino project! What does your system do? I'd be surprised if there isn't some room for optimization in there though. Is it too big to attach?
1978  Using Arduino / Programming Questions / Re: Array of structs or pointer indexing ... Options / Best practice? on: October 24, 2012, 06:14:09 pm
How your example code with the incremented pointer ever worked was bothering me on the drive home. It did, I now suspect, because your junk variables are never used for anything and the compiler was able to optimize them away. Use them for something in the code somewhere and I imagine your example will stop working.
1979  Using Arduino / Project Guidance / Re: detect water and turn on!!! on: October 24, 2012, 12:51:55 pm
Quote
(and presumably they turn off when above),

Yes, but only after a while - 10 minutes?
1980  Using Arduino / Programming Questions / Re: Array of structs or pointer indexing ... Options / Best practice? on: October 24, 2012, 12:02:06 pm
Making assumptions about how variables will be stored in memory is a very dubious practice. Just delare an array of your structs. You should know at compile time how many there are and you can iterate through them looking for the named variable without any need for a pointer.

While you're at it, you'll need to give your name array a size too.
Pages: 1 ... 130 131 [132] 133 134 ... 244