Show Posts
Pages: 1 ... 1886 1887 [1888] 1889 1890 ... 3234
28306  Using Arduino / Programming Questions / Re: Temperature Fan Control PWM Arduino Help! on: March 12, 2012, 04:49:41 am
Why are you storing the temperatures in an array, during the averaging process? The array is completely unnecessary.

if ( tempc < 40 && tempc > 10 ) {
This is hard to read.
if(tempc > 10 && tempc < 40)
is much closer to how people decide to do things. The compiler doesn't care, but it's easier to maintain understandable code.

What, exactly, is connected to pin 3? What kind of fan are you using?
28307  Using Arduino / Programming Questions / Re: LED blinking without delay on: March 12, 2012, 04:44:33 am
i want the led to reset back as low when there is no motion detected,
So, explicitly tell it to turn off.

The first thing you need to do, though, is define what "when there is no motion detected" means, when you are not using a motion sensor. The sensor you are using measures distance.
28308  Using Arduino / Programming Questions / Re: Making LCD menu's: multidimensional char arrays. on: March 12, 2012, 04:28:36 am
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:
#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.
28309  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.
28310  Using Arduino / Programming Questions / Re: Error "WiServer" was not declared in this scope" on: March 11, 2012, 05:34:15 pm
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.

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"?
28311  Using Arduino / Storage / Re: Questions about interfacing with SD card on: March 11, 2012, 04:13:37 pm
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, 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.

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.

28312  Using Arduino / Programming Questions / Re: Program (Sketch) Size Limit for Mega 2560 R3? on: March 11, 2012, 03:37:09 pm
I'm using the basic blink sample sketch and repeating the high, delay, low, delay lines.
28313  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Minecraft Server on: March 11, 2012, 03:28:53 pm
i was wondering how i could run a minecraft server with an arduino.
Go to 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.
28314  Using Arduino / Storage / Re: Questions about interfacing with SD card on: March 11, 2012, 03:24:35 pm
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 accesses, not the SD card itself. No, you can't change that behavior.

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

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.

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.

28315  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.

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:
                    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.
28316  Using Arduino / Programming Questions / Re: Program (Sketch) Size Limit for Mega 2560 R3? on: March 11, 2012, 02:44:44 pm
I can remake the program and give you guys the error message I'm getting, if you want.
Only if you want help.
28317  Using Arduino / Storage / Re: WEB then to SD Card on: March 11, 2012, 12:42:19 pm
I'm perplexed...
And we can't see your code.
28318  Using Arduino / Networking, Protocols, and Devices / Re: artnet to dmx project. memory issues? on: March 11, 2012, 12:36:02 pm
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.

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...
28319  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:
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?

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?

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)?
28320  Using Arduino / Interfacing w/ Software on the Computer / Re: VB6 with Uno serialprint to text box on: March 11, 2012, 11:54:24 am
                   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?
                       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?
Pages: 1 ... 1886 1887 [1888] 1889 1890 ... 3234