Passo 1: Faz tu mesmo
O que é isto?
O primeiro de três projetos para descobrir qual é o consumo de energia da tua casa ou escola, medindo a quantidade de luz que usas.
Este medidor de luz vai-te ajudar a medir a variação da luz à tua volta quando as luzes estão ligadas ou desligadas e encontrar o melhor sítio para colocares o temporizador de luz no próximo projeto.
O que é que vais aprender
- How to take readings from the micro:bit's sensors and store them in a variable so that you can repeatedly view the same reading even after conditions have changed
- Find locations for recording reliable environmental data
- With the lights turned off, place your micro:bit where you want to take the light reading, and press button A.
- Move the micro:bit so you can see its display easily, and press button B to see the light level reading. This will be a number between 0 (dark) and 255 (the most intense light the micro:bit can measure) .
- You can press B again if you're not sure of the reading.
- Turn the lights on and make another measurement by pressing A again, then press button B to read the number.
- Find a place where there is a big difference between the readings when the lights are off and on. Away from a window where daylight might come in, and closer to the electric light source would be best. A cupboard would be ideal, if it has electric lighting.
- Take a few readings and find the average of the readings when the light is turned on. You'll need this number for the next project, the Energy light timer.
Como é que funciona
- The program uses a variable called reading to store the light level. It sets this at the start and whenever you press button A.
- Storing the light sensor reading in a variable, rather than just showing it straight away, is a good idea because it means you can view the reading over and over again when you note it down.
- Using a variable also means you can take a light reading in a place where it might be difficult to see the display and view the light measurement in a more convenient place.
Do que é que precisas
- micro:bit (ou simulador MakeCode)
- Editor MakeCode ou Python
- suporte de pilhas (recomendado)
Passo 2: Cria o teu código
Passo 3: Melhora-o
- Modify the code to calculate an average reading for you.
- Add a second micro:bit and radio functionality to allow remote reading of light levels.
- If you have access to a light meter that measures light levels in other units, compare the micro:bit's readings with it.
- Use the light meter readings to make a timer to record how long lights are left on.