()println
מדפיסה נתונים דרך ערוץ תקשורת טורית כמחרוזת תווים הקריאה לבן אדם ומוסיפה תווים המציינים סוף שורה (תן ASCII 13 או "r\" ואחריו תו ASCII 10 או "n\"). פונקציה זו מקבלת את אותם הנתונים כמו ()Serial.print.תחביר
- קוד: בחר הכל
Serial.println(val);
Serial.println(val, format);
פרמטרים:
val - נתונים שצריך להדפיס, מכל סוג
format - למספרים שלמים מציין את הבסיס להצגה, למספרים עם נקודה צפה מציין את כמות הספרות אחרי הנקודה
הפונקציה מחזירה את כמות הבתים (bytes) שהודפסו. הערך המוחזר הוא מסוג
long
.דוגמה
- קוד: בחר הכל
/*
Analog input
reads an analog input on analog in 0, prints the value out.
created 24 March 2006
by Tom Igoe
*/
int analogValue = 0; // variable to hold the analog value
void setup() {
// open the serial port at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog input on pin 0:
analogValue = analogRead(0);
// print it out in many formats:
Serial.println(analogValue); // print as an ASCII-encoded decimal
Serial.println(analogValue, DEC); // print as an ASCII-encoded decimal
Serial.println(analogValue, HEX); // print as an ASCII-encoded hexadecimal
Serial.println(analogValue, OCT); // print as an ASCII-encoded octal
Serial.println(analogValue, BIN); // print as an ASCII-encoded binary
// delay 10 milliseconds before the next reading:
delay(10);
}
ראו גם:
()begin()end
()available
()read
()peek
()flush
()write
()SerialEvent
פירוט שפת תכנות לסביבת Arduino
עמוד זה הוא תרגום של ()println לפי רישיון Creative Commons Attribution-ShareAlike 3.0.