Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

11.ArduinoISP/ArduinoISP.ino: with 'void pulse(int pin, int times)', it typically pulsestimes + 1, which is unexpected #22

Open
Labels
type: imperfectionPerceived defect in any part of project
@brewmanz

Description

@brewmanz

The following code typically loops one more time thantimes e.g. with 0, it loops once, with 1, it loops twice.

#define PTIME 30void pulse(int pin, int times) {  do {    digitalWrite(pin, HIGH);    delay(PTIME);    digitalWrite(pin, LOW);    delay(PTIME);  } while (times--);}

ADDITIONAL SUGGESTION#1: Decide whether it should loop 0 times or once, whentimes is set to 0; looping almost forever is probably not desired.
ADDITIONAL SUGGESTION#2: Add optional additional parameterint duration that defaults toPTIME or 30.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp