Show Posts
Pages: 1 ... 50 51 [52] 53 54 ... 57
766  Using Arduino / Programming Questions / Re: Instansiating or passing a reference to Serial on: April 14, 2011, 04:41:06 am
Hi Paul...

Well I guess I typed that post too quickly. Yes, you're right, of course there is a big difference between a pointer and a reference. And I should not have capatilized void. I didn't past that code from my actual code, I just typed it.

I'm not actually writing a library, just a class to encapsulate control of a particular device that is controlled by sending commands to. I know it will always be Serial1.

Let me try including that header file, thank you very much!


767  Using Arduino / Programming Questions / Instansiating or passing a reference to Serial on: April 14, 2011, 01:56:06 am
Hi All...

Is it possible to call members of Serial1 from another class? I tried to do:

Serial1.write()

from a class member function but the compiler said "Serial1 not defined in this scope"

So, I tried to pass in a reference to it like this:

Void Buzzer::Buzzer(Serial *);

But it didn't care for that either.

What's the right way to do this?

Thank you...

768  Using Arduino / Programming Questions / Re: loop() apparently is not really a loop... on: April 09, 2011, 12:47:05 pm
That's strange... I doubt it makes a difference but I'm using a Sanguino. I'll do some tests here to see what happened, although I don't have a logic analyzer.
769  Using Arduino / Project Guidance / Re: NMEA 0183 and RS-422 receiving on: April 09, 2011, 12:43:34 pm
I also ran accross someone who had a line of chips with really good isolation built in. I'll have to find those and post. It was pretty early when I saw them and now I can't remember what company it was :-(
770  Using Arduino / Project Guidance / Re: NMEA 0183 and RS-422 receiving on: April 09, 2011, 01:05:20 am
Yes, very much like that Bob, thank you! I guess you now know what's coming ;-)

771  Using Arduino / Programming Questions / Re: C++ for Arduino: any tips? on: April 09, 2011, 12:53:38 am
Oh, one iother thing. If you do use dynamic memory allocation and you have a leak, you're probably going to figure it our very quickly!  smiley-razz
772  Using Arduino / Programming Questions / Re: C++ for Arduino: any tips? on: April 09, 2011, 12:47:52 am
The C / C++ debate is not unique to microcontrollers. The biggest complaint I hear about C++ from my C friends is that all the pointer dereferencing is expensive from a performance standpoint. There are definitely things inside C++ where stuff is done for you, and resources consumed you didn't expect to be consumed, if you don't know how features are implemented.

All that said, I am having great luck with C++ on the Arduino. I was impressed that it supports templates and some other language features. You'll find out that new and delete and new[] and delete[] are not implemented, but that's easy to fix. Be careful though, I noticed that the memory allocator uses a lot of RAM. Wherever I can, I just allocate objects on the stack instead of dynamically allocating them.

Works for me!
 
773  Using Arduino / Programming Questions / Re: loop() apparently is not really a loop... on: April 09, 2011, 12:33:03 am
Ah, so return, okay...

But, I went and added an endless while loop inside my loop() function and I was rewarded with a signifigant increase in performance. I had a delay at the top of the loop method to keep it iterating about once a second. I just had to substantially increase that delay. Apparently calling loop() entails a lot of overhead somewhere.

 
774  Using Arduino / Programming Questions / loop() apparently is not really a loop... on: April 08, 2011, 11:43:41 pm
I just stuck a continue statement inside the loop() function and the compiler complained that I had a continue outside a loop. So, apparently the loop is not really a loop. What's the accepted method of doing this? I suppose I could put an endless while loop inside loop(), but that seems, well, strange...
775  Using Arduino / Project Guidance / NMEA 0183 and RS-422 receiving on: April 08, 2011, 10:13:18 pm
Hi All...

I need to recieve two to three channels of NMEA 0183 and send one channel. I looked around for a level converter chip like a MAX232 but for RS-422, but no luck. Is there an easy circuit or chip to use to convert RS-422 to TTL, ideally with electrical isolation?

Thank you.
 
776  Using Arduino / Programming Questions / Re: Can we know how much RAM a sketch uses? on: April 02, 2011, 06:05:45 pm
Great info, thanks everyone.

It turned out that the Fat16 library I am using to talk to my SD card included a function to report free memory. That works well. Its the same function as in one of the links above.

777  Using Arduino / Programming Questions / Can we know how much RAM a sketch uses? on: March 31, 2011, 11:27:04 pm
Hi All...

Is there a way to know how much RAM a sketch is using?

778  Using Arduino / Programming Questions / Re: Multiple source files? on: March 27, 2011, 04:59:29 pm
Yeah I renamed the file to polar.h but still no joy. I added an absolute path reference inside the include directive and that made it happy. Not the best solution. I see in the FAQ that I can program an Arduino in 100% C/C++ using AVR Studio, and I also see there is a plugin for Visual C++. So I may end up getting away fromt he Arduino IDE, although that's probably going to make other issues.

Thanks for the help everyone. Once I get past these few small issues it will probably move along quickly.
779  Using Arduino / Programming Questions / Re: Multiple source files? on: March 27, 2011, 04:38:56 pm
Anyway, when the IDE opens a sketch, it opens tabs for all other files in the same directory, with known extensions, like .cpp, .c. .h. and .pde.

Header file extensions are generally .h, not .hpp.

Okay I got that working thanks. Am I precluded from having an hpp extension? My source file says #include "polar.hpp" and the hpp file is in there with the source file, but the compiler fails to include it. For example, I get this error:

polar.cpp:1:21: error: polar.hpp: No such file or directory

780  Using Arduino / Programming Questions / Multiple source files? on: March 27, 2011, 04:25:17 pm
Hi All...

Sorry for the really noob question. I have an application I intend to target the Arduino with, but I developed it using Open Watcom (in C++) so I could use the debugger and nicer environment. Today I began to port it to Arduino and I am running into the simplest issues.

I used the sketch->add file menu item to add a CPP file to the sketch. When I try to compile it it can not find the HPP that is included. I put the hpp in the same folder as the cpp, and I even tried to use the same add file option. No joy. Where does an hpp file go?

Thanks...

Jim
 
Pages: 1 ... 50 51 [52] 53 54 ... 57