ආර්ඩුයිනෝ කේත ලිවිම සදහා අවශ්ය බොහෝ තොරතුරු අද අන්තර්ජාලයෙන් පහසුවෙන් ලබා ගත හැක. එහෙත් එම කේතවල ප්රශ්නයක් ඇති වුවහොත් හෝ නිවැරදිව ක්රියා නොකළ හොත් එහි ඇති ප්රශ්ණය සොයා ගැනීම හෙවත් debug කිරීමට අවශ්ය තොරතුරු සොයා ගැනීම නම් ලෙහෙසි නැහැ. මෙම ලිපියෙන් අප අද බලන්න යන්නේ ඒ පිළිබදවයි.
සාමාන්යයෙන් ආර්ඩුයිනෝ කේතයක් කරන්නේ කුමක්ද යන්න සොයා බැලීමට බොහෝ දෙනා කරන්නේ එහි serial monitor එකට යමක් print කර බැලීමයි. එය බොහෝ විට පහත ආකාරයෙන් දැක්වේ.
Serial.println("Here is some math: ");
Serial.print("a = ");
Serial.println(a);
Serial.print("b = ");
Serial.println(b);
Serial.print("c = ");
Serial.println(c);
Serial.print("a + b = "); // add
Serial.println(a + b);
Serial.print("a * c = "); // multiply
Serial.println(a * c);
Serial.print("c / b = "); // divide
Serial.println(c / b);
Serial.print("b - c = "); // subtract
Serial.println(b - c);
නමුත් මින් serial monitor හි print වන දත්ත හඳුනා ගැනීමට පහසු නොවේ. ඊට හේතුව එහි සියල්ල කළු අකුරු වලින් පමණක් මුද්රණය වීමයි. මෙම ප්රශ්ණය විසඳීම සඳහා SerialDebug යන ආර්ඩුයිනෝ library ය යොදා ගත හැක.
එය download කර ARDUINO_HOME/libraries යන ෆෝල්ඩරය තුළ දැමීමෙන් පසු පහත ආකාරයට ඔබගේ Arduino කේත debug කිරීමට යොදා ගත හැක.
#include "SerialDebug.h" //https://github.com/JoaoLopesF/SerialDebug
if (debugAddFunctionVoid(F("benchInt"), &benchInt) >= 0) {
debugSetLastFunctionDescription("To run a benchmark of integers");
}
if (debugAddFunctionVoid(F("benchFloat"), &benchFloat) >= 0) {
debugSetLastFunctionDescription("To run a benchmark of float");
}
if (debugAddFunctionVoid(F("benchGpio"), &benchGpio) >= 0) {
debugSetLastFunctionDescription("To run a benchmark of Gpio operations");
}
if (debugAddFunctionVoid(F("benchAll"), &benchAll) >= 0) {
debugSetLastFunctionDescription("To run all benchmarks");
}
if (debugAddFunctionVoid(F("benchSerial"), &benchSerial) >= 0) {
debugSetLastFunctionDescription("To benchmarks standard Serial debug");
}
if (debugAddFunctionVoid(F("benchSerialDebug"), &benchSerialDebug) >= 0) {
debugSetLastFunctionDescription("To benchmarks SerialDebug");
}
if (debugAddFunctionStr(F("funcArgStr"), &funcArgStr) >= 0) {
debugSetLastFunctionDescription("To run with String arg");
}
if (debugAddFunctionChar(F("funcArgChar"), &funcArgChar) >= 0) {
debugSetLastFunctionDescription("To run with Character arg");
}
if (debugAddFunctionInt(F("funcArgInt"), &funcArgInt) >= 0) {
debugSetLastFunctionDescription("To run with Integer arg");
}
debugAddGlobalBoolean("mBoolean", &mBoolean);
debugAddGlobalChar("mChar", &mChar);
debugAddGlobalByte("mByte", &mByte);
debugAddGlobalInt("mInt", &mInt);
debugAddGlobalUInt("mUInt", &mUInt);
debugAddGlobalLong("mLong", &mLong);
debugAddGlobalULong("mULong", &mULong);
debugAddGlobalFloat("mFloat", &mFloat);
debugAddGlobalDouble("mDouble", &mDouble);
debugAddGlobalString("mString", &mString);
// Note: For char arrays, not use the '&'
debugAddGlobalCharArray("mCharArray", mCharArray);
// Note, here inform to show only 20 characteres of this string or char array
debugAddGlobalString("mStringLarge", &mStringLarge, 20);
debugAddGlobalCharArray("mCharArrayLarge", mCharArrayLarge, 20);
අවවාදයයි: මෙය global විචල්යයන් සඳහා පමණක් බාවිත කළ යුතුයි. local එනම් function යක් තුළ ඇති විචල්යයන් සඳහා කිසිසේත් බාවිත නොකළ යුතුයි.
debugA("**** Setup: initialized.");
// or
printlnA("**** Setup: initialized.");
For errors:
debugE("* This is a message of debug level ERROR");
// or
printlnE("* This is a message of debug level ERROR");
For another levels:
debugV("* This is a message of debug level VERBOSE");
debugD("* This is a message of debug level DEBUG");
debugI("* This is a message of debug level INFO");
debugW("* This is a message of debug level WARNING");
// or
printlnV("* This is a message of debug level VERBOSE");
printlnD("* This is a message of debug level DEBUG");
printlnI("* This is a message of debug level INFO");
printlnW("* This is a message of debug level WARNING");
තවද මේ ආකාරයෙන්ද මුද්රණය කළ හැක.
debugA("This is a always - var d", var);
debugV("This is a verbose - var d", var);
debugD("This is a debug - var d", var);
debugI("This is a information - var d", var);
debugW("This is a warning - var d", var);
debugE("This is a error - var d", var);
debugging කරන ආකාරය පහත වීඩියෝවෙන් බලා ගත හැක.
වැඩි විස්තර සඳහා https://github.com/JoaoLopesF/SerialDebug
Круто, давно искал _________________ [url=https://topgameslist.xyz/mavibet-101-com/]iddaa maksimum kazanГ§ [/url].
Read MoreИнтересная новость _________________ [url=https://google.com.sg/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwiu99CZ6K_sAhVSSxoKHSAjDK4QFjAAegQIAhAC&url=https://worldcrypto.store/?p=14537&usg=AOvVaw2qwfC8Bi40tF7oJnu043VZ]казино в г.
Read MoreКруто, давно искал _________________ [URL=https://zekalocasino.topgameslist.xyz/kazino-prestizh-registraciya/]Казино престиж регистрация[/URL].
Read MorePlease login or register to post a comment.
There are currently no comments.