Serial.print مقابل println
إرسال القيم المُعنونة إلى شاشة Serial Monitor
Serial.print مقابل println درس مجاني في Arduino & IoT Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Arduino & IoT Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Arduino & IoT Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Sending Words Out
Once the channel is open, you send text with Serial.print(). Whatever you pass shows up in the Serial Monitor on your computer.
Serial.print("Hello");Print Stays on One Line
The key thing about Serial.print() is that it does not move to a new line. The next print appears right after it.
Serial.print("Hi");
Serial.print("There");That Prints HiThere
Those two prints produce HiThere, jammed together with no gap. Print never adds spacing for you.
Meet println
Use Serial.println() when you want each message on its own line. The ln means it adds a line break at the end.
Serial.println("Line one");
Serial.println("Line two");Clean, Readable Output
That gives you two tidy rows in the Monitor. println is your go-to for status messages you read top to bottom.
Printing Numbers
You are not limited to text. Pass a number and Serial.print() converts it to readable digits automatically.
int score = 42;
Serial.println(score);Build a Label
Mix text and values for clarity. Print the label first, then print the number, so output reads like a sentence.
Serial.print("Score: ");
Serial.println(score);Why Labels Help
A bare number like 42 means nothing later. A label like Score: 42 tells you exactly what you are looking at.
Print Inside loop
Calls to print and println usually live in loop(), so values keep streaming out as your program runs.
void loop() {
Serial.println("running");
}A Common Pattern
A neat habit: print the label, then println the value. The label glues to the number, then the line wraps cleanly.
Serial.print("Temp: ");
Serial.println(24);Pick the Right One
Reach for print when more output follows on the same line, and println when this is the end of the line. 🙂
Quick Check
Which call ends the current line and moves output to the next row?
Recap
You learned that print keeps output on one line while println adds a break, and that labeling values makes your Monitor easy to read. 🎉
الأسئلة الشائعة
هل درس «Serial.print مقابل println» مجاني؟
نعم — نص درس «Serial.print مقابل println» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Arduino & IoT Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Arduino & IoT Academy 4 دروس في المجموع.
ماذا ستتعلم في «Serial.print مقابل println»؟
إرسال القيم المُعنونة إلى شاشة Serial Monitor تتمرن على Arduino & IoT Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Arduino & IoT Academy؟
لا تُشترط خبرة سابقة. Arduino & IoT Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «Serial.print مقابل println»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Arduino & IoT Academy هذا؟
نعم. كل درس في Arduino & IoT Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- Serial.begin ومعدل البود
- Serial.print مقابل println
- مراقبة قيم المستشعرات مباشرة
- قراءة الأوامر التي تكتبها