Reference.BooleanVariables History

Hide minor edits - Show changes to markup

June 02, 2010, at 07:00 PM by Equipo Traduccion -
Changed lines 1-5 from:

boolean

A boolean holds one of two values, true or false. (Each boolean variable occupies one byte of memory.)

Example

to:

booleanos

Un booleano sólo puede tomar dos valores, Verdadero o Falso. Cada booleano ocupa un único byte en la memoria.

Ejemplo:

Changed lines 7-11 from:

int LEDpin = 5; // LED on pin 5 int switchPin = 13; // momentary switch on 13, other side connected to ground

boolean running = false;

to:

int LEDpin = 5; // LED en el pin 5 int switchPin = 13; // pulsador en el pin 13, su otra patilla conectada en GND

boolean running = false; // crea la variable booleana running y le asisga el valor Falso (false)

Changed line 16 from:
  digitalWrite(switchPin, HIGH);      // turn on pullup resistor
to:
  digitalWrite(switchPin, HIGH);      // conecta la resistencia pull-up interna del pin 13
Changed lines 22-25 from:
  {  // switch is pressed - pullup keeps pin high normally
    delay(100);                        // delay to debounce switch
    running = !running;                // toggle running variable
    digitalWrite(LEDpin, running)      // indicate via LED
to:
  {  // si el pulsador es accionado la pull-up mantiene el pin en estado HIGH
    delay(100);                        // retardo para impedir un rebote en el pulsador
    running = !running;                // invierte el valor de la variable running
    digitalWrite(LEDpin, running)      // enciende el LED
Changed lines 33-36 from:

See also

to:

Ver también:

June 25, 2009, at 01:01 PM by Paul Badger -
June 25, 2009, at 01:00 PM by Paul Badger -
Changed lines 35-36 from:
to:
May 16, 2009, at 08:50 AM by David A. Mellis -
Changed lines 3-4 from:

A boolean variable holds one of two values, true or false. (Each boolean variable occupies one byte of memory.)

to:

A boolean holds one of two values, true or false. (Each boolean variable occupies one byte of memory.)

May 16, 2009, at 08:50 AM by David A. Mellis -
Changed lines 1-6 from:

boolean variables

boolean variables hold one of two values, true or false.

Even though it might be assumed that booleans should occupy only one bit of memory, they are treated by the compiler much the same as byte variables, and actually occupy one byte of memory.

to:

boolean

A boolean variable holds one of two values, true or false. (Each boolean variable occupies one byte of memory.)

May 15, 2009, at 12:41 PM by Paul Badger -
Changed lines 3-4 from:

boolean variables hold one of two values, true and false.

to:

boolean variables hold one of two values, true or false.

May 15, 2009, at 12:40 PM by Paul Badger -
Changed lines 5-6 from:

Even though it might be assumed that booleans should occupy only one bit of memory, they seem to be treated by the compiler much the same as byte variables, and actually occupy one byte of memory.

to:

Even though it might be assumed that booleans should occupy only one bit of memory, they are treated by the compiler much the same as byte variables, and actually occupy one byte of memory.

Added lines 30-32:

May 15, 2009, at 12:36 PM by Paul Badger -
Changed lines 3-4 from:

boolean variables hold one of two values, true and false.

to:

boolean variables hold one of two values, true and false.

Even though it might be assumed that booleans should occupy only one bit of memory, they seem to be treated by the compiler much the same as byte variables, and actually occupy one byte of memory.

May 15, 2009, at 12:26 PM by Paul Badger -
Changed lines 3-4 from:

boolean variables are hold one of two values, true and false.

to:

boolean variables hold one of two values, true and false.

January 21, 2008, at 05:58 PM by David A. Mellis - boolean variables actually take up a full byte of memory.
Changed lines 3-4 from:

boolean variables are one-bit variables that can only hold two values, true and false.

to:

boolean variables are hold one of two values, true and false.

August 27, 2007, at 06:11 PM by David A. Mellis - should only use true and false for booleans (not 0 and 1 or HIGH and LOW)
Changed lines 3-4 from:

boolean variables are one-bit variables that can only hold two values, 1 and 0. Note that the constants HIGH and LOW are also defined as 1 and 0, as are the variables TRUE and FALSE.

to:

boolean variables are one-bit variables that can only hold two values, true and false.

Changed lines 10-11 from:

boolean running;

to:

boolean running = false;

August 23, 2007, at 09:21 PM by Paul Badger -
Changed lines 8-9 from:

int switchPin = 13; // momentary switch on 13

to:

int switchPin = 13; // momentary switch on 13, other side connected to ground

May 29, 2007, at 05:28 AM by David A. Mellis -
Changed lines 7-9 from:
  1. define LEDpin 5 // LED on pin 5
  2. define switchPin 13 // momentary switch on 13

[@

to:

int LEDpin = 5; // LED on pin 5 int switchPin = 13; // momentary switch on 13

Changed lines 11-12 from:

int x;

to:
May 29, 2007, at 05:28 AM by David A. Mellis - cleaning up example code
Changed lines 22-26 from:
  if (digitalRead(switchPin) == LOW){  // switch is pressed - pullup keeps pin high normally
  delay(100);                        // delay to debounce switch
  running = !running;                // toggle running variable
  digitalWrite(LEDpin, running)      // indicate via LED

// more statements

to:
  if (digitalRead(switchPin) == LOW)
  {  // switch is pressed - pullup keeps pin high normally
    delay(100);                        // delay to debounce switch
    running = !running;                // toggle running variable
    digitalWrite(LEDpin, running)      // indicate via LED
  }
May 29, 2007, at 05:27 AM by David A. Mellis - we shouldn't encourage people to assign non-boolean values to boolean variables.
Changed line 5 from:

All of the following will set the variable running to a TRUE condition:

to:

Example

Added lines 7-9:
  1. define LEDpin 5 // LED on pin 5
  2. define switchPin 13 // momentary switch on 13

[@

Deleted lines 10-23:

running = 35; // any non-zero number is TRUE running = -7; // negative numbers are non-zero (TRUE) running = HIGH; // HIGH is defined as 1 running = TRUE; // TRUE defined as 1 running = .125 // non-zero float defined as TRUE

Example

[@

  1. define LEDpin 5 // LED on pin 5
  2. define switchPin 13 // momentary switch on 13

[@ boolean running;

Changed lines 13-16 from:

void setup(){ pinMode(LEDpin, OUTPUT); pinMode(switchPin, INPUT); digitalWrite(switchPin, HIGH); // turn on pullup resistor

to:

void setup() {

  pinMode(LEDpin, OUTPUT);
  pinMode(switchPin, INPUT);
  digitalWrite(switchPin, HIGH);      // turn on pullup resistor
Changed lines 20-24 from:

void loop(){ if (digitalRead(switchPin) == 0){ // switch is pressed - pullup keeps pin high normally delay(100); // delay to debounce switch running = !running; // toggle running variable digitalWrite(LEDpin, running) // indicate via LED

to:

void loop() {

  if (digitalRead(switchPin) == LOW){  // switch is pressed - pullup keeps pin high normally
  delay(100);                        // delay to debounce switch
  running = !running;                // toggle running variable
  digitalWrite(LEDpin, running)      // indicate via LED
May 28, 2007, at 08:53 PM by Paul Badger -
Changed line 10 from:

running = -7; // negative numbers are non-zero

to:

running = -7; // negative numbers are non-zero (TRUE)

Added line 12:

running = TRUE; // TRUE defined as 1

May 28, 2007, at 08:52 PM by Paul Badger -
Changed line 26 from:

digitalWrite(switchPin, HIGH); // turn on pullup resistors

to:

digitalWrite(switchPin, HIGH); // turn on pullup resistor

Changed line 30 from:

if (digitalRead(switchPin) == 0){ // switch is pressed - pullups keep pin high normally

to:

if (digitalRead(switchPin) == 0){ // switch is pressed - pullup keeps pin high normally

May 28, 2007, at 08:51 PM by Paul Badger -
Changed line 30 from:

if (digitalRead(switchPin) == 0){ // switch is pressed

to:

if (digitalRead(switchPin) == 0){ // switch is pressed - pullups keep pin high normally

May 28, 2007, at 08:50 PM by Paul Badger -
Changed line 31 from:

delay(100); // delay to debounce switch

to:

delay(100); // delay to debounce switch

May 28, 2007, at 08:49 PM by Paul Badger -
Changed line 39 from:
to:
May 28, 2007, at 08:48 PM by Paul Badger -
Changed line 40 from:
to:
May 28, 2007, at 08:47 PM by Paul Badger -
Changed lines 3-6 from:

boolean variables are one-bit variables that can only hold two values, 1 and 0. Note that the constants HIGH and LOW are also defined as 1 and 0, as are the variables TRUE and FALSE.

Example

to:

boolean variables are one-bit variables that can only hold two values, 1 and 0. Note that the constants HIGH and LOW are also defined as 1 and 0, as are the variables TRUE and FALSE.

All of the following will set the variable running to a TRUE condition:

Deleted lines 6-8:
  1. define LEDpin 5 // LED on pin 5
  2. define switchPin 13 // momentary switch on 13

[@

Changed lines 8-20 from:

boolean LEDon;

to:

running = 35; // any non-zero number is TRUE running = -7; // negative numbers are non-zero running = HIGH; // HIGH is defined as 1 running = .125 // non-zero float defined as TRUE

Example

[@

  1. define LEDpin 5 // LED on pin 5
  2. define switchPin 13 // momentary switch on 13

[@ boolean running;

Changed line 31 from:

delay(50); // delay to debounce switch

to:

delay(100); // delay to debounce switch

Changed line 34 from:
to:

// more statements

Changed lines 36-40 from:

@]

to:
May 28, 2007, at 08:37 PM by Paul Badger -
Changed line 28 from:
  • ]
to:

@]

May 28, 2007, at 08:37 PM by Paul Badger -
Changed line 7 from:
to:

[@

Added line 28:
  • ]
May 28, 2007, at 08:36 PM by Paul Badger -
Added lines 1-27:

boolean variables

boolean variables are one-bit variables that can only hold two values, 1 and 0. Note that the constants HIGH and LOW are also defined as 1 and 0, as are the variables TRUE and FALSE.

Example

  1. define LEDpin 5 // LED on pin 5
  2. define switchPin 13 // momentary switch on 13

[@ boolean running; boolean LEDon; int x;

void setup(){ pinMode(LEDpin, OUTPUT); pinMode(switchPin, INPUT); digitalWrite(switchPin, HIGH); // turn on pullup resistors }

void loop(){ if (digitalRead(switchPin) == 0){ // switch is pressed delay(50); // delay to debounce switch running = !running; // toggle running variable digitalWrite(LEDpin, running) // indicate via LED

}

Share