Show Posts
Pages: 1 ... 2318 2319 [2320] 2321 2322 ... 3234
34786  Using Arduino / Networking, Protocols, and Devices / Re: Multi serial with Arduino Mini on: August 31, 2011, 08:49:34 am
Quote
SerialRFIDreader.available() is a call of method of one instance ?
and
SerialRS485.available() is a call of method of another instance ?

So, the active instance must change ?
Yes. Notice, though that data that arrived for the non-active instance was lost, so calling the available method on the inactive instance will always return 0.

Calling them in loop(), as you are doing, will result in neither instance ever being able to receive data.
34787  Using Arduino / Programming Questions / Re: transforming received bytes to int on: August 31, 2011, 08:42:59 am
Create a simple sketch to learn how to use strtok() and atof().

Code:
char numbers[] = "-14.7, 235.7, 89.887";

void setup()
{
   char *token1 = strtok(numbers, ",");
   float num1 = atof(token1);
   char *token2 = strtok(NULL, ","); // Keep parsing same array
   float num2 = atof(token2);
   char *token3 = strtok(NULL, ",");
   float num3 = atof(token3);
}

void loop() {}

Add Serial.begin() and Serial.print() statements to see what is in token1, token2, token3, num1, num2, and num3.

Then, apply to your situation.
34788  Using Arduino / Programming Questions / Re: Need help with Camera Trigger on: August 31, 2011, 08:34:43 am
Quote
i just want to fire the camera.
Why? Didn't it show up for work on time?

Quote
I want the Arduino to work like a remote release for my camera.
Quote
Now my problem is, that i dont really know how the camera trigger works, and I dont want to try something, because i don want to break my expensive camera.
Quote
The Focus is manually, i just want to fire the camera.
All this about cameras and we still don't know anything about the camera, except that it wasn't cheap.

What brand/model? Is there any kind of remote control available for it? (Doesn't matter if you actually have the remote, or not. Just whether there is any kind of remote triggering capability - wired or wireless.)
34789  Using Arduino / Programming Questions / Re: spliting a string from bluetooth on: August 31, 2011, 08:30:49 am
Quote
First one is that these 3 values that im sending as a string, can be negative or float number so the incoming string length is changing all the time. Ive tryed this code with a 10 character length but its not working ok.
You'll need to determine a maximum length string that you can handle. Suppose all the values are floats, all negative, and all as large as possible. Each number can meaningfully have a sign, some number of digits before the decimal point (does 8 seem reasonable?), a decimal point, and some number of digits after the decimal point (only 7 have any hope of being accurate). So, allow up to 20 characters per number, including the comma, so your array should be 60 characters long.

If you have any control over the sending end, and can limit the number of decimal places, or know that the maximum absolute value of the number will be less than 8 digits, you can make the array smaller.

Code:
    while(blueToothSerial.available() < 10) { // Wait until we receive 5 characters
I love it when the comments match the code.

Quote
Second that i dont have any idea how to do it is that i want to split this string in to 3 different variables..
A little research on the strtok() and atof() functions is in your future, then.
34790  Using Arduino / Programming Questions / Re: transforming received bytes to int on: August 31, 2011, 08:23:53 am
Quote
Ive also read tutorials on sprintf() and atoi() but i'm just not sure one which i need too work.
Then you should know that sprintf is how you convert a number to a string, and that it doesn't work for floats.

Since you want to convert a string to a number, sprintf is NOT what you want.

You should also be aware that atoi() is the ASCII (a) to (to) integer (i) conversion function.

Given this, can you guess the name of the ASCII (a) to (to) float (f) conversion function?
34791  Using Arduino / Programming Questions / Re: Multi dimentional Array on: August 31, 2011, 08:18:04 am
Quote
Still it doesn't work. Wonder why?
Wonder what the code looks like, now.
34792  Community / Gigs and Collaborations / Re: Need an Arduino Programmer and Developer for pay on: August 31, 2011, 06:29:07 am
Quote
Ok, so back to this question again:
Need more details of how the LEDs are to be lit up. Individually? All colors controlled at once? In groups somehow?
What difference does it make? OP said:
Quote
The control will he with a PC.
Therefore, all the Arduino needs to do it listen to the serial port, parse the incoming data, and send that out to the first LED to which the others are daisy-chained.

The PC application to generate the data will be a bitch, but programming the Arduino(s) will be trivial.
34793  Using Arduino / Networking, Protocols, and Devices / Re: Multi serial with Arduino Mini on: August 31, 2011, 06:24:38 am
Quote
You say "Changing the active instance". Can you explain how to do that ?
I already did.
Quote
Switching which instance is active occurs whenever a method on any instance is called.
34794  Using Arduino / Programming Questions / Re: Multi dimentional Array on: August 31, 2011, 06:14:51 am
Quote
Am I still out of memory? So why there is no Warning or Error message?
Yes. The amount of SRAM needed at run time is a function of the number/type/size of the global variables you define, the number/length of literal strings, the number/type/size of local variables you define, the number/type/size of arguments you pass to functions, and the order and depth that those functions are called in.

Only some of that information can be obtained at compile time.

It would be nice if the compiler popped up a message when the amount of SRAM that it knows is used exceeds the amount available, but, alas, that is not the case.

It is up to you to be aware of the limits and write code appropriately.

34795  Using Arduino / Programming Questions / Re: Develop and compile with Xcode 4 on: August 31, 2011, 06:09:28 am
Quote
Xcode uses CLang for C/C++/Obj-C/C++
Can CLang produce machine code for an avr chip? I doubt it.

Even if it can, you still plan to use the Arduino IDE to upload code to the Arduino. When you do that, it won't upload the machine code that XCode/CLang produced. It invokes the compiler/linker to generate new machine code that it uploads.

At best, you could use the XCode editor to edit the sketch, in which case, where the include files really are is not an issue.
34796  Using Arduino / Programming Questions / Re: Multi dimentional Array on: August 31, 2011, 06:00:09 am
Quote
I have two Arrays
1. byte D[64] and
2. byte TB[27][256]
27 * 256 = 6912 bytes of the 2K that you have available, unless you have a Mega, in which case you have 8K. Even if you do, you are probably still running out of memory.
34797  Using Arduino / Programming Questions / Re: Develop and compile with Xcode 4 on: August 31, 2011, 05:46:11 am
Quote
Because the compiler can't F$?&#%?&# find anything.
Which compiler? The XCode compiler can't find the avr or Arduino include files, but, so what? They are written in C or C++, which the XCode compiler can't deal with, anyway.

Quote
I'm trying to compile something for the Arduino using Xcode
The XCode compiler can't generate output for the avr chip, so this doesn't make sense.
34798  Using Arduino / Storage / Re: Other problem with dumpfile from SD card on: August 31, 2011, 05:37:48 am
Quote
The code comes from the example, just a little bit modified, so i am not the author of this sentence in the code, but since it has a "!" symbol, it is not trying to start the SD, just only to check if it is already done. Am i right?
No, I'm sorry, you are not.

The SD.begin() function attempts to initialize the card, and return true if successful, or false, if not.

The ! in front says to negate the logic state returned by the SD.begin() function, for the purposes of the if test.

The code is equivalent to:
Code:
boolean openStatus = SD.begin(chipSelect);
if(openStatus == false)
{
    Serial.println("Card failed, or not present");
    return;
}
Written this way, you can see that the SD.begin() function gets called every time DownloadData() gets called, which is not what you want to do, since SD.begin() WILL fail if called a second time, apparently.

I'd move the Sd.begin() call, and related error handling, to setup().
34799  Using Arduino / Networking, Protocols, and Devices / Re: Multi serial with Arduino Mini on: August 31, 2011, 05:15:08 am
Quote
You can use many instances of NSS in parallel as long as there is not too much traffic as the Arduino is single threading.
But, only one instance at a time can receive. NewSoftSerial uses an interrupt to catch the incoming data. When the interrupt fires, the data that is incoming is for the active instance.

Switching which instance is active occurs whenever a method on any instance is called. Changing the active instance changes which interrupt handler is attached, which changes which instance can receive data.

Multiple instances can send easily enough, but only one instance can receive at a time.

It looks like you think you can receive from two instances at once, which is not the case. To do that, you need two (or more) hardware serial ports, which use two (or more) interrupts - one for each hardware port. The only Arduino with multiple hardware serial ports is the Mega.
34800  Using Arduino / Programming Questions / Re: combining two sketches help on: August 31, 2011, 04:48:07 am
Still missing the Serial.print() statements that tell you that:
Yes, the on/off switch was turned on.
Yes, the up switch was pressed.
Yes, the down switch was pressed.
Yes, the switch press count was incremented/decremented correctly.

Before we go on, though, what kind of switch are you using for the on/off switch? Momentary contact or toggle? The code assumes a toggle switch, but I suspect that you are using a momentary contact switch.
Pages: 1 ... 2318 2319 [2320] 2321 2322 ... 3234