...
Code Block | ||
---|---|---|
| ||
#include <CrcLib.h>
using namespace Crc;
void setup()
{
CrcLib::Initialize();
}
void loop()
{
CrcLib::Update();
}
//Lines starting with 2 slashes won't be compiled; they are comments.
/*This is a way
to comment multiple lines of code */
|
...
This is how Arduino IDE loads the CrcLib when compiling the code, allowing the use use its functions. This will of course only work if the library as first been properly installed as detailed here.
...
Code Blockinfo | ||
---|---|---|
| ||
using namespace Crc; |
...
Once upon a time, using namespace Crc was needed at the top of every program. Since it was only boilerplate, this requirement has been removed. You might still stumble on some relics of the past, and in that case, simply remove this line at the top of the file. |
...
Code Block | ||
---|---|---|
| ||
void setup() { //The code executed once at power-up } |
...
Code Block | ||
---|---|---|
| ||
#include <CrcLib.h> using namespace Crc; void setup() { CrcLib::Initialize(); Serial.begin(96002000000); //Establishes a 2 9600Mbps baud rate connection with the monitor. } void loop() { CrcLib::Update(); //Prints to the Serial monitor the Analog Input Port #1 value Serial.println(CrcLib::GetAnalogInput(CRC_ANA_1)); //Prints the code execution time to the Serial monitor unsigned int deltaMicros = CrcLib::GetDeltaTimeMicros(); Serial.println(deltaMicros); } |
...