Un universo de extensiones con mBlock5
Se describe cómo utilizar las diferentes extensiones para objetos y como crear extensiones para módulos en placas arduino Se describe cómo utilizar las diferentes extensiones para objetos y como crear extensiones para módulos en placas arduino
UN UNIVERSO DE EXTENSIONES EN MBLOCK5Es decir, nuestra carpeta DHT incluirá estos 13 archivos:Si abrimos el archivo DHT.h con WordPad, por ejemplo, nos encontramos con lo siguiente:Resulta que con esta librería podemos conectar cualquiera de estos sensores:SUSANA OUBIÑA FALCÓN PÁGINA 133 DE 207
UN UNIVERSO DE EXTENSIONES EN MBLOCK5Y en apartado “public” vemos el siguiente código que, para muchos de vosotros/as puede serlegible y para otros muchos no serlo tanto:Una traducción puede ser la siguiente:• Tenemos que declarar el sensor con el comando DHT (nº del pin al que está conectado,tipo de sensor).• Será necesario iniciar el sensor en void setup con el comando dht.begin• Podemos obtener la temperatura con readTemperatura() y la humedad conreadHumidity()• El último comando de la lista read(void) es una variable de tipo booleano. Esto quieredecir que solo tiene 2 valores, verdadero o falso, lo que nos permite usarlo en bloquesde tipo condicional.Para muchos esta información es más que suficiente para comenzar a crear la extensión enmBlock Extension Builder. Pero si no lo tenemos claro, debemos buscar por la red “¿Cómoprogramar un sensor DHT en Arduino?”. El resumen de la búsqueda se puede ver en lassiguientes imágenes:• Para Inicializar el sensorSUSANA OUBIÑA FALCÓN PÁGINA 134 DE 207
- Page 83 and 84: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 85 and 86: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 87 and 88: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 89 and 90: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 91 and 92: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 93 and 94: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 95 and 96: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 97 and 98: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 99 and 100: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 101 and 102: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 103 and 104: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 105 and 106: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 107 and 108: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 109 and 110: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 111 and 112: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 113 and 114: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 115 and 116: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 117 and 118: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 119 and 120: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 121 and 122: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 123 and 124: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 125 and 126: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 127 and 128: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 129 and 130: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 131 and 132: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 133: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 137 and 138: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 139 and 140: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 141 and 142: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 143 and 144: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 145 and 146: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 147 and 148: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 149 and 150: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 151 and 152: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 153 and 154: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 155 and 156: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 157 and 158: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 159 and 160: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 161 and 162: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 163 and 164: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 165 and 166: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 167 and 168: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 169 and 170: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 171 and 172: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 173 and 174: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 175 and 176: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 177 and 178: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 179 and 180: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 181 and 182: UN UNIVERSO DE EXTENSIONES EN MBLOC
- Page 183 and 184: UN UNIVERSO DE EXTENSIONES EN MBLOC
UN UNIVERSO DE EXTENSIONES EN MBLOCK5
Y en apartado “public” vemos el siguiente código que, para muchos de vosotros/as puede ser
legible y para otros muchos no serlo tanto:
Una traducción puede ser la siguiente:
• Tenemos que declarar el sensor con el comando DHT (nº del pin al que está conectado,
tipo de sensor).
• Será necesario iniciar el sensor en void setup con el comando dht.begin
• Podemos obtener la temperatura con readTemperatura() y la humedad con
readHumidity()
• El último comando de la lista read(void) es una variable de tipo booleano. Esto quiere
decir que solo tiene 2 valores, verdadero o falso, lo que nos permite usarlo en bloques
de tipo condicional.
Para muchos esta información es más que suficiente para comenzar a crear la extensión en
mBlock Extension Builder. Pero si no lo tenemos claro, debemos buscar por la red “¿Cómo
programar un sensor DHT en Arduino?”. El resumen de la búsqueda se puede ver en las
siguientes imágenes:
• Para Inicializar el sensor
SUSANA OUBIÑA FALCÓN PÁGINA 134 DE 207