Temperature Sensor Challenges
The temperature sensor integrated into micro:bit detect the temperature in Celsius degrees.
Challenge #1: Digital Thermometer
A thermometer is an instrument used to measure temperature. The most common type consists of a sealed glass capillary tube ending in a small reservoir containing a certain amount of mercury or alcohol. This mercury or alcohol expands when the temperature rises and contracts when it falls, and the resulting volume changes are read on a graduated scale.
Digital thermometers use transducer devices and electronic circuits to convert the small voltage variations into numerical values, ultimately displaying the temperature on a screen.
Objective.
Display on the LED panel the temperature detected by the temperature sensor integrated into the micro:BIT.
Code description.
We suggest using the ‘On Start’ event, which is in the ‘Basic’ category. This block allows the code entered to be executed when the micro:BIT starts up.
Next,Añadir weel willbloque, uselocalizado theen ‘Displayla String’categoría block,Básico, alsomostrar foundnúmero. inEste thebloque ‘Basic’muestra category,en andla enterpantalla theLED textel “Hellonúmero World!!!”.introducido, Thisdesplazándose blocksi displayses themayor enteredde text1 character by character.cifra.
TheSustituir codeel willnúmero look“0” aspor follows.el valor obtenido del sensor de temperatura. Este bloque se localiza en la categoría Entrada.
TheA enteredcontinuación textse stringborra willla immediatelypantalla beginy tose beintroduce readuna onpausa thede 1000 ms. Quedando el programa de la siguiente forma:

En el simulador aparecerá una barra vertical que permite modificar la temperatura, siendo la temperatura marcada la mostrada en el panel LED.

Propuesta.
Hacer un programa que al pulsar el botón A muestra la temperatura en grados celsius y al pulsar el botón B la temperatura mostrada sea en grados Fahrenheit.
Reto Aviso de placas de hielo.
La mayoría de coches incorporan en el salpicadero, junto a la pantalla que marca la temperatura exterior, un testigo con forma de copo de nieve, que avisa de la posibilidad de que haya placas de hielo en la carretera. Este testigo se suele iluminar cuando la temperatura baja de 3 grados centígrados.
Objetivo.
Mostrar en el panel LED panel.de Thela text doesn't fit entirely, so it will scroll automatically.
Extra exercise
Modify the code, so that it shows the programmer's name.
Challenge #2: Animations
Animation is a technique that creates the illusion of movement in static images. It is achieved through a sequence of ordered images which, when displayed consecutively, generate the visual illusion of motion.
Objective.
When the micro:micor:BIT isun connected,icono acon beatingforma heartde willcopo bede displayednieve oncuando thela LEDtemperatura panel.esté por debajo de 3 grados.
CodeDescripción description.
del código.
ThePara "forever"iniciar event,el locatedprograma, inse thepropone Basicusar category,el willevento bepara used.siempre. Posteriormente se debe añadir el operador lógico si … entonces situado en la sección Lógica. Este bloque verifica si es verdad que se cumple una condición, si es así, ejecuta las instrucciones introducidas.
Inside the previous block, place the instruction to show icon, using the heart icon.
AddPara thecomprobar pausesi blockla (ms(100))temperatura locatedestá inpor thedebajo Basicde category.los 3º centígrados se usará el operador que devuelve verdadero siempre que 3 sea mayor que el valor reportado por el sensor de temperatura. El bloque se localiza en la categoría Lógica.
Repeat the two previous blocks, but this time selecting the "small heart" icon.

Immediately,Para mostrar un icono con forma de copo de nieve se usará el bloque mostrar LED, también se debe añadir el bloque borrar la pantalla para que no se quede encendido el panel LED cuando suba la temperatura de 3º centígrados

Una vez terminado el código, aparecerá el símbolo de hielo, cuando la temperatura sea menor de 3º centígrados.

Propuesta.
Añadir un aviso sonoro cuando la temperatura sea inferior a heart3 thatgrados appears to be beating is displayed in the simulator.celsius.
ExtraReto exercise
Temperatura óptima de una nevera
ModifyLa thetemperatura code,óptima byde usingun thefrigorífico blockes "de show7ºC, leds"somientras thatque itla showstemperatura de un congelador debe estar entorno a scissorlos opening-18ºC. andAlgunas closing.
incorporan un avisador acústico que se activa cuando la temperatura no es la óptima.
Challenge #3: Designing iconsObjetivo.
MakeCodeMostrar allowsen youel to graphically design the icons to be displayed on thepanel LED display.de Forla thismicro:BIT purpose,la ittemperatura hasdel afrigorífico specificy blockactivar locateduna inalarma thecuando Basicla category.temperatura Theesté blockpor isencima calledde “show LEDs” and allows the user to design their own icons by independently selecting the LEDs they want to illuminate.
Objective.
Design an icon in the shape of an Indalo. This is a cave painting found in the province of Almería, representing a human figure with outstretched arms and an arch above its hands. It is currently considered a symbol of the province of Almería.
CodeDescripción description
del código.
TheEn "Oneste Start"reto event,se locatedincorpora inun thealtavoz Basiccomo category,actuador willexterno. beSe used.conectará uno de los polos al GND y el otro al PIN 0.
PlacePara theiniciar "showel LEDs"programa instructionse insideusará theel previousbloque block,“para whichsiempre”. isDentro alsose locatedsituará inel thecondición Basic“si category.entonces”. ThisLa blockcondición allowsa youverificar toserá: independentlysi selectla thetemperatura LEDses youmayor wantde to7 light up.grados.
ClickSi onel thevalor LEDses youverdadero wantentonces tose illuminatereproducirá untilun youtono achievede the desired icon.aviso.
También se muestra la temperatura medida.
The result will be displayed in the simulator area.
Extrael exercise.
simulador Designse codepuede thatvariar displaysla atemperatura logopara designedcomprobar byel thecorrecto programmer.funcionamiento del programa.
Information extracted and translated from catedu.








