I bought some Rebel LED parts (http://www.sparkfun.com/products/9748) and I was planning to use my Arduino UNO as the PWM generator. The Sparkfun link provided some sample code for the Arduino, but it appears to be in raw C++ files that the Arduino program refuses to open; it gives me an error message saying it only opens .pde files.
I’m pretty new to this, so I would appreciate any help. How do I open those files and load them into the Arduino?
Out of curiosity, what does the empty void loop function do? When I forgot to add it in, I got this error message:
core.a(main.cpp.o): In function `main’:
C:\Documents and Settings\Nate\My Documents\Downloads\arduino-0022\arduino-0022\hardware\arduino\cores\arduino/main.cpp:10: undefined reference to `loop’
Most C languages use main as the main entry point. From main one normally does the initialization and then for most embedded work start an infinite loop for processing. Arduino breaks that mold and gives you two entry points. One (setup) that gets called once on power up, and then loop that gets called from an infinite loop.
The arduino “core” contains a main() function that looks like:
main()
{
setup();
while (1)
loop();
}
This is/was a philosophical decision, reflecting the way a microcontroller can’t “end” a program, and it means that both setup() and loop() need to be defined elsewhere in the “sketch.” setup() is somewhat more like main() in that it is only called once, so renaming main() from a cpp program being ported to setup() is slightly easier than renaming it to loop() and putting some kind of “stop” at the end.