עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

שאלת מתחילים בקשר לכתיבת פונקציה void

Featured Replies

פורסם

הקוד הבא אמור לגרום לLED להבהב בקוד מורס את השם דניאל באנגלית.

עם ההפעלה הנורה מהבהבת מהר פעמים וזהו.

מישהו יכול לעזור, היכן הטעות?

הערה: void loop נמצא בסוף הקוד, אבל זה לא משנה אם הוא בתחילתו, זה לא עובד גם כך. העתק הדבק הפך את הסדר, אבל אין שגיאות קומפילציה, הנורה לא מהבהבת (והיא כן מהבהבת אם מופעלת תוכנית הדוגמא blink)

תודה

void setup() {

pinMode(13, OUTPUT);

}

void writeD()

{

writeLine;

writeDot;

writeDot;

}

void writeA()

{

writeDot;

writeLine;

}

void writeN()

{

writeLine;

writeDot;

}

void writeI()

{

writeDot;

writeDot;

}

void writeE()

{

writeDot;

}

void writeL()

{

writeDot;

writeLine;

writeDot;

writeDot;

}

void writeDot()

{

int shortBlink=500;

int longBlink=1000;

digitalWrite(13,HIGH);

delay(shortBlink);

digitalWrite(13,LOW);

delay(shortBlink);

}

void writeLine()

{

int shortBlink=500;

int longBlink=1000;

digitalWrite(13,HIGH);

delay(longBlink);

digitalWrite(13,LOW);

delay(shortBlink);

}

void loop()

{

writeD;

writeA;

writeN;

writeI;

writeE;

writeL;

}

פורסם

סוגריים ריקים אחרי שם הפונקציה כשקוראים לה.

פורסם

ממה שאני יכול להבין מקוד שלך:

הגדרת פונקציות לכתיבת האותיות שמרכיבות שת השם שלך.

הגדרת פונקציה שקוראת לפונקציות שמרכיבות את השם שלך.... loop()

אני לא מוצאתי בקוד מקום שבו אתה קורא לפונקציה loop() לפעול.

ולכן אין שגיאת קימפול כי הקוד בסדר. אין הדלקת לדים כי לא קראת לפונקציה לבצע זאת....

- - - תגובה אוחדה: - - -

תיקון לתגובה...

טעות שלי.... ()void loop נראתה לי לרגע כפונקציה חדשה ולא חלק מה IDE.

אין ספק שהבעיה היא בהוספת סוגריים () אחרי כל קריאה לפןנקצית האותיות :

לדוגמא :

;()writeD

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.