预览模式: 普通 | 列表

我和我们

        我叫戴劲,网名Burn。有雕塑和动画的学习经历,现任教于川音成都美术学院。我与其他老师和学生组建锐梵互动,致力于互动新媒体的研究与创作,并对外提供原创互动展示项目开发和商业培训等服务。

        如果您想深入了解我们的工作或合作洽谈,请联系我们。
        QQ:20889444
        MSN :24672468小老鼠sina.com

分类:实验室 | 固定链接 | 评论: 2 | 引用: 0 | 查看次数: 83306

Unsigned Long

unsigned long

Description描述

Unsigned long variables are extended size variables for number storage, and store 32 bits (4 bytes). Unlike standard longs unsigned longs won't store negative numbers, making their range from 0 to 4,294,967,295 (2^32 - 1).
Unsigned long variables是用于储存数值的变量的一种扩展方式,可以储存32 bits (4bytes)。Unsigned long特别之处在于不能储存负值,其储存的值的范围是0 到 4,294,967,295。

 

Example范例

unsigned long time;
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.print("Time: ");
time = millis();
//prints time since program started
// 在程序开始后返回时间。 Serial.println(time); // wait a second so as not to send massive amounts of data
// 延迟1秒,以便发送大量的数据。 delay(1000); }

Syntax语法

    unsigned long var = val;

 

  • var - your long variable name 变量名
  • val - the value you assign to that variable 分配给变量的值

 

See Also

Tags: arduino双语手册

分类:arduino双语手册 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 1070

Long

long

Description描述

Long variables are extended size variables for number storage, and store 32 bits (4 bytes), from -2,147,483,648 to 2,147,483,647.
Long变量是更大范围的数值储存方式,可以储存32位(4字节),从-2,147,483,648 到 2,147,483,647之间的数值。

 

Example范例

long time;
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.print("Time: ");
time = millis();
//prints time since program started
// 得到从程序开始正常运行的时间 Serial.println(time); // wait a second so as not to send massive amounts of data
// 延迟1秒,以便发送大量的数据。 delay(1000); }

Syntax语法

    long var = val;

 

  • var - your long variable name 你的长整数变量名
  • val - the value you assign to that variable 你指定给这个变量的值

 

See Also

Tags: arduino双语手册

分类:arduino双语手册 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 680

Millis

unsigned long millis()

Description

Returns the number of milliseconds since the Arduino board began running the current program.
返回Arduino卡开始正常运行程序后的毫秒数。

 

Parameters参数

None 无

 

Returns返回

The number of milliseconds since the current program started running, as an unsigned long. This number will overflow (go back to zero), after approximately 9 hours.
返回自从当前程序开始运行后的毫秒数,这是一个无符号的长整数。如果这个值超过了大约9小时,会产生数据溢出(返回到0)。

 

Examples范例

long time;
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.print("Time: ");
time = millis();
//prints time since program started
// 得到从程序开始正常运行的时间 Serial.println(time); // wait a second so as not to send massive amounts of data
// 延迟1秒,以便发送大量的数据。 delay(1000); } /* Frequency Test
频率测试 * Paul Badger 2007 * Program to empirically determine the time delay to generate the * proper frequency for a an Infrared (IR) Remote Control Receiver module * These modules typically require 36 - 52 khz communication frequency * depending on specific device.
程序为一个红外(IR)遥控接受装置试验地决定延迟时间,以便产生适当的频率。这个模块最典型的要求是36 - 52 khz的频率。 */ int tdelay; unsigned long i, hz; unsigned long time; int outPin = 11; void setup(){ pinMode(outPin, OUTPUT); Serial.begin(9600); } void loop() { for (tdelay = 1; tdelay < 12; tdelay++){
// scan across a range of time delays to find the right frequency time = millis(); // get start time of inner loop for (i = 0; i < 100000; i++){ // time 100,000 cycles through the loop digitalWrite(outPin, HIGH); delayMicroseconds(tdelay); digitalWrite(outPin, LOW); delayMicroseconds(tdelay); } time = millis() - time; // compute time through inner loop in milliseconds hz = (1 /((float)time / 100000000.0)); // divide by 100,000 cycles and 1000 milliseconds per second // to determine period, then take inverse to convert to hertz Serial.print(tdelay, DEC); Serial.print(" "); Serial.println(hz, DEC); } }

See also

Tags: arduino双语手册

分类:arduino双语手册 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 730

unsigned int

unsigned int

Description描述

Unsigned ints (unsigned integers) are the same as ints in that they store a 2 byte value. Instead of storing negative numbers however they only store positive values, yielding a useful range of 0 to 65,535 (2^16) - 1).
Unsigned ints(无符号整数)和 ints一样都可以储存2byte的值。它将用于储存负数的空间用来储存正数,因此,它们能储存0 到 65,535的正值。

The difference between unsigned ints and (signed) ints, lies in the way the highest bit, sometimes refered to as the "sign" bit, is interpreted. In the Arduino int type (which is signed), if the high bit is a "1", the number is interpreted as a negative number, and the other 15 bits are interpreted with 2's complement math.

 

Example范例

    int ledPin = 13;

 

Syntax语法

    int var = val;

 

  • var - your int variable name 你的变量名
  • val - the value you assign to that variable 你指定给变量的值

 

Coding Tip编码提示

When variables are made to exceed their maximum capacity they "roll over" back to their minimum capacitiy, note that this happens in both directions
当变量值超过其最大取值范围,它会“翻转”到它的最小值,注意它在两个方向都可能发生。

 

   unsigned int x
x = 0;
x = x - 1;       // x now contains 65535 - rolls over in neg direction
// x现在为65535-翻转到它的反方向。 x = x + 1; // x now contains 0 - rolls over
//x现在为0-翻转到它的反方向。

 

See Also另见

Tags: arduino双语手册

分类:arduino双语手册 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 953

Int

int

Description描述

Integers are your primary datatype for number storage, and store a 2 byte value. This yields a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of (2^15) - 1).
整数是你最初级的数据储存类型,可以储存 2 byte的值。它可以表现 -32,768到 32,767 (最小值 -2^15 最大值 (2^15) - 1)。

 

Int's store negative numbers with a technique called 2's complement math. The highest bit, sometimes refered to as the "sign" bit, flags the number as a negative number. The rest of the bits are inverted and 1 is added.
整数储存负数的技巧请见2's complement math

 

The Arduino takes care of dealing with negative numbers for you, so that arithmetic operations work transparently in the expected manner. There can be an unexpected complication in dealing with the bitshift right operator (>>) however.

 

Example范例

    int ledPin = 13;

 

Syntax语法

    int var = val;

 

  • var - your int variable name 你的整数变量名
  • val - the value you assign to that variable 你设定的变量值

 

Coding Tip代码技巧

When variables are made to exceed their maximum capacity they "roll over" back to their minimum capacitiy, note that this happens in both directions.
当变量的值超过了它的最大值后会“翻转”到它们的最小值,注意,在两个方向都可能发生。

 

   int x
x = -32,768;
x = x - 1;       // x now contains 32,767 - rolls over in neg. direction
// x现在为 32,767-翻转到反方向。 x = 32,767; x = x + 1; // x now contains -32,768 - rolls over
// x现在为 -32,767-翻转到反方向。

 

See Also

Tags: arduino双语手册

分类:arduino双语手册 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 625