Show Posts
Pages: 1 ... 7 8 [9] 10 11
121  Forum 2005-2010 (read only) / Syntax & Programs / Re: Scrolling menu program hangs... on: May 20, 2010, 12:24:55 am
I'm having a hard time following your code. As far as more menu examples, I recall seeing a few different menu libraries in one of the Arduino libraries pages.
122  Forum 2005-2010 (read only) / Syntax & Programs / Re: append a float 2 a string? on: June 27, 2010, 01:28:45 am
>> drhex <<

Thanks for the thread tip!  smiley That is exactly what I was trying to do. If anyone else out there is looking for a easier way to convert a floating point to a string, goto the thread posted by drhex above.

Much Thanks!  smiley smiley smiley
DJ
123  Forum 2005-2010 (read only) / Syntax & Programs / Re: append a float 2 a string? on: June 27, 2010, 12:46:02 am
Quote
But you hope others will?

No Sir, I apologize if it sounds that way. :-[ I love to learn. My question is a simple one (I think, I may be wrong. :-?). How can I get the string library to accept the float variable that the dallas library outputs? I'll keep reading until I find the answer. I thought the forum was a place for everyone to learn from each other. smiley-wink

Always thankful for replies,
DJ
124  Forum 2005-2010 (read only) / Syntax & Programs / Re: append a float 2 a string? on: June 26, 2010, 07:44:18 am
I didn't save the code. I didn't put much time into it. I used the Dallas Temperature library and copied the single device example sketch and I used method 1 in the printTemperature() functionin of the example to scan for devices. Then I set up the led display's RX to the TX of serial1 on the arduino Mega. I used the standard serial port for debugging. The only changes I made to the example code were adding the string library, setup 'stringX' of length Y, and at the bottom of the printTemperature() function I added the following code:

stringX.append(sensors.getTempF(deviceAddress));

Thats where the error occured. I also wrote a small function to do some string manipulation and got no errors there. I believe the problem is that I'm trying to append a float to a char string with the string lib. I was hoping someone here had an easy solution for what I'm trying to do.

Thanks for any help,
DJ  
125  Forum 2005-2010 (read only) / Syntax & Programs / append a float 2 a string? on: June 26, 2010, 05:26:16 am
I'm using a one-wire temp sensor with the one-wire library(v2.0) and everything works fine. I'm trying to show the temp on a serial 4-dig LED display (sparkfun). The problem is I need to seperate the decimal point from the float variable the 1-wire library gives me. I tried to use the string library's .append to make a string out of the float, but I get:

error: call of overloaded 'append(float)' is ambiguous.

I have to send 4 bytes (1 for each digit) to the display, as the actual values for each digit or ASCII char values for the numbers. My display will print a blank for the dec.pt. or a negative sign.

Any suggestions on how to convert a float to a char string?

Thanks,
DJ
126  Forum 2005-2010 (read only) / Syntax & Programs / Re: Strange error message? on: June 17, 2010, 08:31:17 am
I'm using an Arduino Mega, so I'm fairly certain I have enough flash. The flash arrays are less than 256 bytes. I would put post the code, but it's for a project I hope to sell some day. :-/ Does this error mean that after the sketch has completed uploading it fails verification? One other thing the LED on pin 13 blinks after uploading and the sketch doesn't use pin 13 at all. Strange!  :-?

Thanks again for the help guys,
DJ
127  Forum 2005-2010 (read only) / Syntax & Programs / Re: Strange error message? on: June 17, 2010, 02:48:56 am
No, my MCU's not toast. I loaded a larger sketch and it works fine. I've had this error before and as I recall it had something to do with using FLASH_ARRAY. I can't remember how I fixed the problem. I would like to know the cause though. Frustrating!

Thanks for the reply,
DJ
128  Forum 2005-2010 (read only) / Syntax & Programs / Strange error message? on: June 16, 2010, 08:03:39 pm
I,ve written a sketch that compiles with no errors. It seems to upload fine, but at the very end of uploading, I get:

avrdude: verification error, first mismatch at byte 0x1d00
         0xff != 0x91
avrdude: verification error; content mismatch

Can someone tell me what this means, and/or what to look for to fix the problem.

Thankful for any help,
DJ
129  Forum 2005-2010 (read only) / Syntax & Programs / Re: #define vs. const variable on: June 06, 2010, 07:01:29 pm
Well, it's been more than 6 months since I last read this post and I am learning a lot. smiley-sweat I'm learning more on the use of preprocessor commands, and #defining macros. Apparently you can do quite a few very useful things with #define. It's not just for defining constants! smiley-eek I've learned so much from this forum as well as the playground. Another thing I have found to be an invaluable method for learning how to achive specific tasks, and even better, tasks I had not even thought of, is to open and study all the library files. Most of them are very well commented, explaining every step of the way through the code. Even if you don't understand some of the concepts being used when you first read through it, you will remember seeing it before and now it makes sense.

Once again, thanks to everyone on this forum for their contributions smiley-grin,
DJ   
130  Forum 2005-2010 (read only) / Syntax & Programs / Re: #define vs. const variable on: June 02, 2010, 04:25:21 pm
I understand a little better now. As far as checking the assembly code to see which is better, I, like PaulS,  am not qualified to do. :-/

Thanx again for the info. guys,
DigitalJohnson
131  Forum 2005-2010 (read only) / Syntax & Programs / #define vs. const variable on: June 02, 2010, 01:17:43 pm
I've read somewhere that it's better to use a const variable rather than use #define. However, I also read that #define uses no program memory or RAM after compiling. So now I'm not sure which is better to use, or if one is better than the other in different cases. If any Admins or God Members read this, please post a reply I'm very interested hearing the facts.

Thanks, DigitalJohnson
132  Forum 2005-2010 (read only) / Syntax & Programs / Re: A question about file extentions of tabs in IDE. on: May 20, 2010, 08:36:19 am
I never thought of it that way. So, as an intermediate programmer, what I'm really looking for is more examples of use (the experience of others (people like you)). smiley-razz

I'm off to work now. Thanks PaulS,
DigitalJohnson
133  Forum 2005-2010 (read only) / Syntax & Programs / Re: A question about file extentions of tabs in IDE. on: May 20, 2010, 07:56:44 am
Thanks for the quick replies PaulS.
I'm pretty new to C, but I think I'm picking it up fairly quickly. If I understand you correctly, I put my function definitions  into an .h file. Then my use of those functions into a .c/.cpp file. Is that a correct way of putting it? Or am I misunderstanding what you mean by implementation? What I've been doing is to put related function definitions and as much of the use of those functions as I can into a header file only.

Thanks again for taking the time to explain things to me. Is there any literature on this that is easy to understand. I pick things up quickly, but I've noticed when trying to research some new aspect of the C language, there's alot of stuff for beginers (very basic) or advanced users (very technical/unfamiliar terms used). I'm somewhere in the middle.

Again thanks for any help.
DigitalJohnson
134  Forum 2005-2010 (read only) / Syntax & Programs / Re: A question about file extentions of tabs in IDE. on: May 20, 2010, 05:48:37 am
Thanks for the reply PaulS.
  I need to clarify. I understand the use of .h as tab ext's. What is the use of/how do I use .c or .cpp as a tab ext. Just to see what would happen, I changed the extention of a tabbed file from .h to c. and changed the #ifndef, #define, #endif and #include to match and got errors(as I expected to).
135  Forum 2005-2010 (read only) / Syntax & Programs / A question about file extentions of tabs in IDE. on: May 19, 2010, 11:40:21 pm
  I'm starting to write larger sketches and finding out how important the organization of code is the larger a program becomes. I'm using the Arduino IDE to compsose my code and started using tabs to break the code into semi-managable chunks. When I named the tabs I didn't give any extention to the names (didn't even know I could). But the IDE would treat the code as if it were just one big file.

  Then I learned a little about making them into header files and "#include"ing them into the main sketch which enables me to isolate the different sections of code and localize the variables within them. Very useful!

  Somewhere in the learning section on the Arduino site  I recently came accross this -

Tabs, Multiple Files, and Compilation:

Allows you to manage sketches with more than one file (each of which appears in its own tab). These can be normal Arduino code files (no extension), C files (.c extension), C++ files (.cpp), or header files (.h).

  My question is, what is the difference/use of using the .c or .cpp extentions in the tabs of the Arduino IDE. Is there any benifit in doing that. I know that libraries have to have both .h and .c files. Would I be better off learning how to write libraries. Which, by the way, is a little confusing. I can't seem to find much about how to write libraries that doesn't asume the reader has a fair knowledge of C language.

A little babbling about myself.
  I've only been using C for 5-6 months. I used to write programs in machine language on my Commodore 64 (yes I'm that old). About the time windows 95 came out I started using PC's and there was so much software already available I didn't see the need to write programs anymore. But, I've been into electronics since I was 9. So when I came across the Arduino while browsing the internet the geek in me had to have one. Now I've got some ideas I'd like to develope, maybe even make a buck or two. So, now I have to start programming again  :smiley.

P.S. I give thanks to the Arduino team for the devices they've created, which allow the rest of us to more easily and very affordably create our own devices of the future. (And thanks to everyone in the Open-Source movement)
Pages: 1 ... 7 8 [9] 10 11