lecciones de programacion intermediasev3lessons.com › es › programminglessons › intermediate...
Post on 10-Jun-2020
4 Views
Preview:
TRANSCRIPT
BySanjayandArvindSeshan
LECCIONESDEPROGRAMACIONINTERMEDIAS
VARIABLES
Objetivos1. Conozcalosdiferentestiposdevariables
2. Aprendaaleeryescribirvariables
Prerrequisitos:CablesdeDatos,SensordeColor,BloquePantalla,BloqueEsperar
©2015EV3LESSONS.COM,LASTEDIT7/06/2016 2
Extra:BloquePantalla“Conectado”
©2015EV3LESSONS.COM,LASTEDIT7/06/2016 3
Texto a mostrar Click en el icono para Conectado
Entrada del TextoLimpiar pantalla anteriorColumna de inicioFila de inicioTexto blanco o negroTamaño
0 – Normal1 – Negrita2 – Grande
Variables¿Quéesunavariable?R.- Unavariableguardaunvalorquedespuéspuedeserusadoenelprograma.Míralocomounacajadondeguardascosasparadespuésusarlas.
Puedesponercualquiernombrealavariable
Lostiposdevariablesson:◦ Numérico(guardaunnumero)◦ Lógico(guardaunVerdadero/Falso)◦ Texto(Guardalíneasdetexto“Holamundo”)◦ ArregloNumérico(guardaunaseriedenúmeros…1,2,3,10,55)◦ Arreglológico(Guardaunaseriedevaloreslógicos…Verdadero,Falso,Falso)
Puedenusarseconentradasysalidasasíquepuedenusarsepara….◦ Escribir– Poneunvalorenlavariable◦ Leer– Sacaelultimovalorescritoenlavariable
©2015EV3LESSONS.COM,LASTEDIT7/06/2016 n4
¿PorquéusarVariables?LasvariablessonformasdemoverdatosportodoelprogramasintantosCablesdeDatos.
PuedesusarvariablesparatransferirdatosdentrodeunMiBloquesinnecesidaddeparámetrosdeentrada(ejem.UnavariableparaeltamañodelaruedaenMove-inches – Noseañadeunaentradaporqueraramenteestevalorcambia.Puedesusarlavariableenvarioslugaresysolocambiarlaenunpuntoespecial.)
LasvariablesArreglopuedenguardarymanejarmuchosdatossinnecesidaddetantoscablesdedatos.Puestenermuchasvariablesomuchoscablesdedatospuedecomplicarelprograma
©2015EV3LESSONS.COM,LASTEDIT7/06/2016 5
BloquesdeVariables
©2015EV3LESSONS.COM,LASTEDIT7/06/2016 6
Escribir Numero
Leer Numero
Escribir Lógico
Leer Lógico
Escribir Texto
Escribir (Entradas) apuntan hacia arriba
Leer (Salidas) Apuntan hacia abajo
Numérico Lógico Texto
Elbotóndelaizquierdadeterminaeltipodevariableautilizar
Leer texto
TIP:CuandoelBloqueEV3muestraunvalorlógicoenlapantalla,lohacecon1o0.1esverdaderoy0esFalso
SalidasdelasVariables
©2015EV3LESSONS.COM,LASTEDIT7/06/2016 7
VariableNumérica:Mostraraelnumero10
VariableLógica:Mostrara0enlapantalla
VariabledeTexto:Mostrara“Hello”enlapantalla
Escribaenlavariable
MostraremoselvalordelavariableenlapantalladelBloqueEV3
¿Puedeadivinarquevaloresobtendrá?
DesafíosDesafío1:◦ ConstruyaunprogramaquemuestrecuantasveceshapresionadoelbotónArriba
Desafío2:◦ Construyaunprogramaquemuestrecuantaslíneasnegrashacruzado
©2015EV3LESSONS.COM,LASTEDIT7/06/2016 n8
Inicio
Meta
Desafío2
SoluciónDesafío1:ContadordeClicks
©2015EV3LESSONS.COM,LASTEDIT7/06/2016 n9
Recuerdeinicializarlasvariablesen0aliniciodecadaprograma,estoborraracualquierdatonodeseadoquepuedacontener.
SoluciónDesafío2:Contadordelíneas
©2015EV3LESSONS.COM,LASTEDIT7/06/2016 n10
SiguientesPasosUsaremosVariablesenlassiguientesLecciones:◦ Avanzado:MenuSystem(ConsulteDisponibilidadenEspañol)◦ Avanzado:ParallelBeamSynchronization (ConsulteDisponibilidadenEspañol)
©2015EV3LESSONS.COM,LASTEDIT7/06/2016 11
CréditosEstetutorialfuecreadoporSanjaySeshanyArvindSeshan
Masleccionesdisponiblesenwww.ev3lessons.com
TraducidoporDavidDanielGalvánMedrano
©2015EV3LESSONS.COM,LASTEDIT7/06/2016 12
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
top related