首页 > 文档 > delay()延迟
2017
07-03

delay()延迟

2.delay()

Name名称):delay() //延迟

Examples例子):

import processing.serial.*;

Serial myPort;  // The serial port串行端口

void setup() {

                         printArray(Serial.list());

  myPort = new Serial(this, Serial.list()[0], 9600);

}

void draw() {

                   while (myPort.available() > 0) {

                  int inByte = myPort.read();

    println(inByte);

  }

  delay(100);

}

 

Description描述):The delay() function halts for a specified time. Delay times are specified in thousandths of a second. For example, running delay(3000) will stop the program for three seconds and delay(500) will stop the program for a half-second.

delay()函数在指定的时间内暂停。延迟时间是在千分之一秒内指定的。例如,运行延迟(3000)将停止程序3秒,延迟(500)将停止程序半秒。

The screen only updates when the end of draw() is reached, so delay() cannot be used to slow down drawing. For instance, you cannot use delay() to control the timing of an animation.

只有当绘制结束时,屏幕才会更新,因此delay()不能用于减慢绘图速度。例如,您不能使用延迟()来控制动画的时间。

The delay() function should only be used for pausing scripts (i.e. a script that needs to pause a few seconds before attempting a download, or a sketch that needs to wait a few milliseconds before reading from the serial port.)

delay()函数只应该用于暂停脚本(例如,在尝试下载之前需要暂停几秒钟的脚本,或者需要等待几毫秒才能从串行端口读取的脚本)

Syntax(语法):delay(napTime)

Parameters (参数):napTime——milliseconds to pause before running draw() again再次运行draw()之前的毫秒

Returns返回值):Void(

Related相关函数):frameRate

draw()

 

 

 

 

 

 



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。