NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » .h File for "for loops" and other basic C commands like that?
March 02, 2012 by Neilman30 |
I'm looking for a header file (.h) that contains the code needed so that I can use for loops with my micro-controller. If anyone knows where I can download a file like this please reply! |
---|---|
March 02, 2012 by pcbolt |
@Neilman30 You don't need a header file for the "for" loops. It is part of the standard "C" language. The nerdkits lcd.c file has some examples of the syntax you'd use. |
March 03, 2012 by Neilman30 |
I know it's part of the standard C language but it said it didn't recognize the for loops in command prompt but it's fine I just changed them to while loops. |
March 03, 2012 by Neilman30 |
I do have another question though. Can the micro-controller handle multiple conditions in the while loop.
|
March 03, 2012 by RevMoses |
if you try the temperature sensor code from the PDF that came with your kit, you will see a for loop very similar to the following in the main method
|
March 03, 2012 by pcbolt |
Hi Neilman30 - You should be able to use multiple conditions in your while loop. Just to be safe, put each condition in its own parenthesis, like this:
In regards to the "for" loop, did you initialize "i" previously in the code? If not you should get an error, but usually it's an "uninitialized variable" error. I've never seen the compiler complain about "for loops" before (unless the syntax is wrong). |
Please log in to post a reply.
Did you know that a thermometer can be made "faster" by using a bit of math? Learn more...
|