Show Posts
Pages: 1 ... 1887 1888 [1889] 1890 1891 ... 3235
28321  Using Arduino / Programming Questions / Re: Making LCD menu's: multidimensional char arrays. on: March 12, 2012, 04:28:36 am
Quote
After reading for a bit, I found out that 2D arrays need to be declared via a pointer.
You are reading in the wrong place, then.

However, even before you begin to initialize the array, you need to consider this:
Code:
#define CHAR 16   //Number of characters per LCD line
 #define MAX  100  //Max number of menu items
 #define ROW  2    //Number of LCD rows
16 * 100 * 2 = 3200 bytes of the 2K that you have available, if you are using a 328-based board.

Try making MAX a (much) more reasonable value.
28322  Using Arduino / Storage / Re: Questions about interfacing with SD card on: March 11, 2012, 05:56:31 pm
The data is read from the file in 512 byte chunks. You can't force a read. When the buffer that was last read is empty, another read from the file occurs. You can't control when that happens, unless you make each record (or collection of records) exactly 512 bytes.

No idea about HID or how you would make your device appear as a HID.
28323  Using Arduino / Programming Questions / Re: Error "WiServer" was not declared in this scope" on: March 11, 2012, 05:34:15 pm
Quote
I downloaded the source code from a website and also got an Arduino for the project but while compiling the program I got an error {'WiServer'  was not declared in this scope}
Was that the ONLY error you got? It seems unlikely.

Quote
Also I am unable to mount my Arduino UNO to my computer.So please help me in this regard and oblige.
Maybe use some duct tape? What do you mean by "mount the Arduino"? On what operating system? What happens when you try to "mount the Arduino"?
28324  Using Arduino / Storage / Re: Questions about interfacing with SD card on: March 11, 2012, 04:13:37 pm
Quote
So if a large portion is read into the buffer, how does it know when to go back and read more?  Or is that what I need to control?
When you read(), as with Serial.read(), the character is removed from the buffer. When the buffer is empty, a read() causes another buffer-full of data to be fetched. This, of course, is time-consuming.

Quote
But, if it's not needed here since I will be reading sequentially at all times, then I won't bother adding that unnecessary data.
That will make reading the data faster, since there is less of it.

28325  Using Arduino / Programming Questions / Re: Program (Sketch) Size Limit for Mega 2560 R3? on: March 11, 2012, 03:37:09 pm
Quote
I'm using the basic blink sample sketch and repeating the high, delay, low, delay lines.
Why?
28326  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Minecraft Server on: March 11, 2012, 03:28:53 pm
Quote
i was wondering how i could run a minecraft server with an arduino.
Go to http://www.minecraft.net/download and download the version for the Arduino. Oh, wait. There isn't one. Perhaps the Windows one could be modified. It's only a 270 KB download. Should fit easily in the Arduino's 32 K of code space. Or not.
28327  Using Arduino / Storage / Re: Questions about interfacing with SD card on: March 11, 2012, 03:24:35 pm
Quote
My question is, is it possible to "stream" this data.  In other words, rather than having the MCU open the file and read the whole thing in memory to execute, is it possible to read-as-needed?
Not only is is possible, it is impossible not to. The function to read from the SD card, like the function to read from the serial port, reads one character at a time.

Behind the scenes, a larger portion of the file is read into a buffer. It it that buffer that SD.read() accesses, not the SD card itself. No, you can't change that behavior.

Quote
in_idx is simply the instruction index.
So, why bother? This value, if needed, can be inferred from the record number.

Quote
I suppose I can open/close the file each time, but I'm more concerned about delays in doing that.
You don't need to. Open the file once. Close the file once. Read the file in a while loop that executes until the whole file has been read.

Quote
What potential problems and/or headaches will I encounter here?
Anything from none at all to complete migraines. Depends on whether you test the code as you go, or try to write it all first, then test.

28328  Using Arduino / Interfacing w/ Software on the Computer / Re: VB6 with Uno serialprint to text box on: March 11, 2012, 03:10:28 pm
I think it is time for you to post ALL of your VB app. One thing you should have at the top is Option Explicit which will force you to define the type of every variable that you use. That way, you won't have to post a link and a code snippet to tell me what type a variable is. You will KNOW what type it is.

A useful thing to do is to name variables with the type (or at least a hint as to the type) as part of the name. intPos is good. lngLen is awful, because the type is not implied by the name.

Quote
Do not know how long I can say I am a new bie
I presume that you mean you don't know how often you need to say that you are a newbie. I'm trying to help you lose that title. It is not something to be proud of or hung onto tenaciously

If you are now sending name=value data from the Arduino, and I agree that you should, there should be nothing in front of the name or after the value. So, a lot of what you are trying to do is unnecessary. I'd also suggest that tab is not a good end of record marker any more. Get rid of the tab, and use Serial.println() to send the value. Then, in VB look for CR/LF as the end of record marker.

Might I also suggest that none of the values that you were printing were named A1, so making up a name and sending and mapping that name to a field makes no sense. Send the real name. Name the text field in VB to match the name that the value should be stored in.

So, back to the code:
Code:
                    Dim bufferlocA1 As String
                    Dim ingLen As String
Neither of these should be String. They should be Integer.

Are you familiar with the F1 key in VB? Position the cursor in a function name, or double click the name to highlight the whole name. Press F1 to get help on the function. The Left function takes a string and a value. The first n characters of the specified string are returned by the Left function, which, given the string and the position of the = or colon (whichever separator you use between the name and value on the Arduino) should be the name. The Right function, with the length of the string minus the same value should give you the value (or maybe len - n - 1; you need to experiment).

Use the name to determine which field to store the value string in.
28329  Using Arduino / Programming Questions / Re: Program (Sketch) Size Limit for Mega 2560 R3? on: March 11, 2012, 02:44:44 pm
Quote
I can remake the program and give you guys the error message I'm getting, if you want.
Only if you want help.
28330  Using Arduino / Storage / Re: WEB then to SD Card on: March 11, 2012, 12:42:19 pm
Quote
I'm perplexed...
And we can't see your code.
28331  Using Arduino / Networking, Protocols, and Devices / Re: artnet to dmx project. memory issues? on: March 11, 2012, 12:36:02 pm
Code:
byte buffer_dmx[number_of_channels+channel_position]; //buffer to store filetered DMX data
There's a 1/4 of your memory, if you have other than a Mega.

Quote
Things i have tried: Instead of receiving all of the 512 dmx channels i have tried to limit this to just one. but same thing happens but after ca 25 seconds instead of 10.
Doesn't really look like that...
28332  Using Arduino / Interfacing w/ Software on the Computer / Re: VB6 with Uno serialprint to text box on: March 11, 2012, 12:28:38 pm
Do you see a similarity between these lines:
Code:
intPos = InStr(strBuffer, vbCrLf)
posA1 = InStr(strInput, "A1:")

In one case you store the return value in what looks like an int. In the other, you store the return value in a string. Why?

Code:
bufferA1 = Mid$(strInput, 1, posA1 + 6)
Now, you are adding 6 to a string. What do you expect the result of that operation to be?

Code:
temp4 = Left$(bufferA1, 1, ((ingLen - bufferlocA1) + 3))
Now, here you are subtracting a string from something (an int?) and adding 3 to the result. What is ingLen? Why is it named the way it is? What do you expect to have happen when you subtract a string from it? What type is the result of (ingLen - bufferLocA1)?
28333  Using Arduino / Interfacing w/ Software on the Computer / Re: VB6 with Uno serialprint to text box on: March 11, 2012, 11:54:24 am
Code:
                   temp1 = InStr(strInput, "A1:") 'gives a position result
So, why is a position stored in variable named temp1? Why is it not stored in a variable call a1Pos?
Code:
                       temp2 = Mid$(strInput, 1, temp1 + 6) 'put A1: seperator and 4 extra characthers in the string
Now we have a variable called temp2, which implies that the variable is the same kind as temp1. Clearly, it isn't. Surely, there is a more meaningful name you could assign to this bit of information.

What type are temp1, temp2, temp3, and temp4?

What problem are you seeing with the temp4 assignment statement?
28334  Using Arduino / Interfacing w/ Software on the Computer / Re: Processing JMyrom ColorTracker - cant find my error on: March 11, 2012, 11:48:21 am
In your original code, you have a global one dimensional array named a and a local two dimensional array named a.

Why?
28335  Using Arduino / Interfacing w/ Software on the Computer / Re: String sent via serial printing every letter on new line on: March 11, 2012, 11:43:14 am
Quote
I'm new at this so bare with me, but I'm thinking that "hello world" is being put into an array and the each letter is being printed by Serial.println rather than the whole string.
It is being put in an array (inData) AND being printed by Serial.println().

Stop printing each character. In the if(started && ended) block, add Serial.println(inData); instead.

Quote
The other problem I have is that only the last letter of the string "hello world" is being printed to the top line of my LCD.
Is this also because of the way the string is being packaged?
That is because you reset the cursor before printing each character.
Pages: 1 ... 1887 1888 [1889] 1890 1891 ... 3235