-
-
Save anonymous/4836950702ff3438df86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//declarar variables | |
int A = 0; | |
int B = 0; | |
//definimos una tercera variable auxiliar | |
//para asi poder intercambiar el valor de las variables | |
int C = 0; | |
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin (9600); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
A = random (0,10); | |
B = random (11,20); | |
Serial.print("A = "); | |
Serial.println(A); | |
delay(500); | |
Serial.print ("B = "); | |
Serial.println(B); | |
Serial.println(); | |
delay(500); | |
//asignamos el valor de A a C, en A guardamos el valor de B | |
//y luego le damos a B el valor de C | |
C = A; | |
A = B; | |
B = C; | |
Serial.print("A= "); | |
Serial.println(A); | |
delay(500); | |
Serial.print ("B = "); | |
Serial.println(B); | |
Serial.println(); | |
delay(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment