Show Posts
Pages: 1 ... 1888 1889 [1890] 1891 1892 ... 3235
28336  Using Arduino / Programming Questions / Re: Softserial versus Hardware Serial on: March 11, 2012, 11:38:53 am
Code:
String get_counter()
This function stores data in a global character array, properly NULL terminating. Then, it converts that global array to a String variable to return. The only that that happens with that String object is printing.

The Serial.print() function is perfectly capable of printing the global character array.

So, why are you dragging in the overhead of the String class?

Code:
NewSoftSerial pc(4, 5); //RX4 TX5
What is this instance for?

Quote
All I do was creat the virtual Serial ports but the output from each are diferent
But, it's a secret what the outputs are?
28337  Using Arduino / Interfacing w/ Software on the Computer / Re: Processing JMyrom ColorTracker - cant find my error on: March 11, 2012, 10:52:36 am
Quote
the code is like this, and it doesnt work:
"But it doesn't work" is nothing but whining.

That code does something. You want to see it doing something. If those two somethings were the same thing, you most likely would not be saying "but it doesn't work".

However, we have no idea what it is doing, or what it is you want/expect/need it to be doing.
28338  Using Arduino / Programming Questions / Re: Convert string of variable length to floats. on: March 11, 2012, 10:46:27 am
Code:
  char buf[7];
Code:
  while ((n = file.read(buf, sizeof(buf))) > 0)
Code:
if (strlen(buf)==9)
strlen() is a string function. It, therefore, expects a NULL terminated array of chars. Unpredictable results can be expected if you pass it something other than a string.

Leaving aside the fact that you refuse to properly NULL terminate the string, how do you expect to get strlen() to measure that there are indeed 9 characters in the 7 element array?

Code:
temperatura = atof(buf);
atof() is also a string function. It, therefore, expects a NULL terminated array of chars. Unpredictable results can be expected if you pass it something other than a string.
28339  Using Arduino / Project Guidance / Re: GameCube Controller + Arduino (My First Project) on: March 11, 2012, 09:40:23 am
Quote
Yellow is connected to the 5v on the arduino.
Blue is connected to the 3.3v on the arduino.
2 out of 3 ain't bad. Sounds like a Meatloaf song.
28340  Using Arduino / Programming Questions / Re: Problem in receiving the data from Bluetooth module on: March 11, 2012, 09:25:08 am
So, you need to set started to true when the + arrives. After each character is added (including the \r and \n) to the array, test if the last 4 characters are 'D', 'O', 'N', and 'E'. If so, set ended to true.

Then, in the started and ended section, use strtok() with \n as the delimiter, to extract each token and print/store the token, after making sure that the \n and \r are stripped from the token.

You can then move all the code back to loop, but sending the INQ command should not happen unless there is a trigger event - a switch press or something.
28341  Using Arduino / Interfacing w/ Software on the Computer / Re: how to use 2 usb serial port at the same time on computer on: March 11, 2012, 09:18:36 am
Quote
i need some guide on the library
What library?

Quote
and the C# code
What C# code?
28342  Using Arduino / Project Guidance / Re: GameCube Controller + Arduino (My First Project) on: March 11, 2012, 09:17:21 am
Quote
Yellow             5V power supply (used by rumble motor).
Where is this connected? Why is this connected?

Quote
Blue    1            3.3V logic supply
Where is this connected?

28343  Using Arduino / Programming Questions / Re: Problem with EEPROM.h on: March 11, 2012, 09:03:23 am
Quote
Are you saying I need #include<EEPROM.h> in EEPROMTest.ino as well as in Test.cpp even though EEPROMTest.ino doesn't appear to use it?
Yes.
28344  Using Arduino / Programming Questions / Re: 2 arduinos communicating over internet from different LAN's on: March 11, 2012, 08:55:55 am
Quote
i have 2 arduinos (1 arduino UNO and 1 arduino MEGA, both have ethernet shields) how could i get them to communicate with each other so that if the MEGA gets a message on its serial port a light comes on on the UNO and visa versa
Ethernet and serial are completely separate channels of communication. You would need both Arduinos to act as both client and server, and to use an intermediate server as data repository, so that each client has a place to look for data and each server has a place to put data.
28345  Using Arduino / Programming Questions / Re: Problem with EEPROM.h on: March 11, 2012, 08:49:50 am
Quote
Why is this?
The files from the sketch directory are copied to a temporary folder for the compile/link process to operate in. All files in the sketch directory AND all files included in the sketch are copied. In your case, EEPROM.h is not included in the sketch, so it is not copied, so it is not available to include in the cpp file.

Quote
Can you only include EEPROM.h in an ino file?
No, but you must ALSO include it in the sketch.

Quote
Is this a known problem?
It's a known condition. Whether it is a problem or not depends on your perspective/background/etc.
28346  Using Arduino / Project Guidance / Re: GameCube Controller + Arduino (My First Project) on: March 11, 2012, 08:20:46 am
Quote
The red cable is connected to the digital pin 2 on the arduino.
What else is connected to the Arduino?
28347  Using Arduino / Programming Questions / Re: incrementing ? on: March 11, 2012, 07:51:27 am
Quote
Shouldn't those two "stepper"s be capitalized? i.e., Stepper(80,5,6), Stepper(75,9,10)
Yes.
28348  Using Arduino / Interfacing w/ Software on the Computer / Re: how to use 2 usb serial port at the same time on computer on: March 11, 2012, 07:42:04 am
Quote
can i do like that??i have the concept like this also...because it is simplest way to do it. I am using windows, using arduino GUI. It is using C language right. any special library need to included? is it same as normal code to use void setup() and then void loop()?
You can't write a PC application using the Arduino IDE.
28349  Using Arduino / Programming Questions / Re: Object oriented or not? on: March 11, 2012, 07:26:08 am
Quote
If I was taking a test as part of a job interview and the test was - 'write something that makes elegant use of OO to solve a problem' and I was offered a PC or an Arduino, I would take the PC.
Fine. But, if the job was to develop code for embedded processors, and your app consumed 4 GB of ram, that would not then scale to the intended job target.

The Serial/Stream/Print classes prove that OO on Arduino works, elegantly.
28350  Using Arduino / Programming Questions / Re: Problem in receiving the data from Bluetooth module on: March 11, 2012, 07:21:14 am
Code:
   Serial.println('\n'); 
Useful. Not!

Quote
All the devices are getting detected and being printed. But they should be printed in one go. Further, only   
The problem is that the data is not all arriving at once. So, on one pass through loop, you get some data in response to the INQ command, and on the next pass through loop, you get some more data, and on the next pass, you get some more.

There is clearly a start of packet marker (+INQ:), and field delimiters (\r\n), but I don't see any kind of end of packet marker, unless that DONE part is the end of the data.

What I would try is putting the code to send data to the device in setup, along with the calls to readprocess(). Leave just the call to readatinq() in loop.

In readatinq(), PRINT EVERY CHARACTER READ!!!

Remove the useless Serial.println('\n') calls.

Load the sketch to the Arduino, and show the output.

If it turns out that +INQ: and DONE bound the data stream, then you can modify readatinq() to store data until the array ends with DONE.
Pages: 1 ... 1888 1889 [1890] 1891 1892 ... 3235