Micro:Bit Advent Calendar Day 10 - Measure Temperature and Humidity with micro:bit


#1

Need help for the Micro:Bit Advent Calendar Day 10 (Measure Temperature and Humidity with micro:bit)? Just post on this thread and our highly trained team of Micro:Bit ninjas will be able to help you in no time!


#2

Good morning, ninjas!

Hitting a problem with today’s challenge…

Have loaded the DHT library files in Step 6, and gone on to enter the required program into the Arduino IDE.

But, when I verify the code in Step 11, I get a red error message:

In file included from D:\rholg\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.cpp:22:0:

D:\rholg\Documents\Arduino\libraries\DHT_sensor_library\DHT_U.h:25:29: fatal error: Adafruit_Sensor.h: No such file or directory

Is there another library that is required?

Thanks

Rob


#3

Hi Rob, try downloading the “Adafruit Unified Sensor” library from the Library Manager. That will work with the existing code.


#4

We had problems with the Arduino IDE, but we fixed it.

When we followed the setup instructions, installing “Nordic Semiconductor nRF5 Boards” it took ages, and I decided it had crashed. So I force quit (macOS) and tried again, this time it worked quickly.

Then we verified the code from the days instructions and got this error:

fork/exec /Users/[my-username]/Library/Arduino15/packages/sandeepmistry/tools/gcc-arm-none-eabi/5_2-2015q4/bin/arm-none-eabi-g++: no such file or directory
Error compiling for board BBC micro:bit. 

To fix, I uninstalled “Nordic Semiconductor nRF5 Boards” and reinstalled, this time being more patient :slight_smile: I grabbed myself a cuppa and watched in macOS Activity Monitor to make sure it was still working. It took about 5 mins to install, but it got there, and all is now working fine.

FYI


#5

Cherie - thanks: that gets the code compiling. But I can’t get it to load/run. I’ve checked the wiring (twice), with no luck.

And I retried the other Arduino day (Day 8?) and it no longer works. But the other environments still do - Day 6 (the OLED display) still works with both mu and MakeCode.

I suspect that I should unload/reload the various Arduino libraries, or even the Arduino IDE???

Rob


#6

@Rob, have you (do you need to) reapplied the SoftDevice hex file after using MicroPython?

(Step two here: https://www.littlebird.com.au/learn/104/set-up-arduino-ide-for-micro-bit)

(Sorry that’s a shot in the dark, and I can’t see why it would help actually. :confused: )


#7

Can’t see why it would help either - what is a “SoftDevice radio” and why would we need it for this program?

But it worked, and my temperature and humidity numbers are now scrolling up the Serial Monitor screen

Many thanks!


#8

Running a bit behind, catch up on the weekend!

We can’t get this one to work either, I think for a different reason to those described above.

This is a copy of the Sketch uploading log:

Sketch uses 14160 bytes (9%) of program storage space. Maximum is 151552 bytes.
Open On-Chip Debugger 0.10.0-dev-00254-g696fc0a (2016-04-10-10:13)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 0
swd
cortex_m reset_config sysresetreq
adapter speed: 1000 kHz
nrf51.cpu: target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0xc1000000 pc: 0x000006d0 msp: 0x000007c0
** Programming Started **
auto erase enabled
wrote 14336 bytes from file C:\Users\Admin\AppData\Local\Temp\arduino_build_897983/Day-10-sketch.ino.hex in 1.346965s (10.394 KiB/s)
** Programming Finished **
** Verify Started **
verified 14288 bytes in 0.173018s (80.646 KiB/s)
** Verified OK **
** Resetting Target **
shutdown command invoked

We had to download the “Adafruit Unified Sensor” library for it to verify successfully, but when we try to upload it we get the log shown above. As you can see it never says “Done uploading”, and if we try to open the serial monitor it says “Board is not available”

We’ve tried reapplying the SoftDevice hex file as per the suggestion above from @Mike but that didn’t help.


#9

Hi Tim, what port have you got it set to under Tools > Port in the Arduino IDE?
Also what is set on Tools > Board
As well as on … Tools > Softdevice?

The port should be set to

As for the board, it should be set to BBC micro:bit, and the Softdevice set to S110. :slight_smile:


#10

Thanks @cherie, setting the port fixed the problem. The Board and Softdevice were already correct.