File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 22
22
],
23
23
"public" : true ,
24
24
"targetVersions" : {
25
- "target" : " 4.0.16 " ,
25
+ "target" : " 4.0.17 " ,
26
26
"targetId" : " microbit"
27
27
},
28
28
"supportedTargets" : [
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ namespace weatherbit {
40
40
41
41
// BME280 Addresses
42
42
const bmeAddr = 0x76
43
+ const bmeId = 0xD0
43
44
const ctrlHum = 0xF2
44
45
const ctrlMeas = 0xF4
45
46
const config = 0xF5
@@ -460,6 +461,17 @@ namespace weatherbit {
460
461
export function startWeatherMonitoring ( ) : void {
461
462
if ( weatherMonitorStarted ) return ;
462
463
464
+ //Check if there is a BME attached - and simulate weather if not
465
+ let id = readBMEReg ( bmeId , NumberFormat . UInt8LE )
466
+ if ( id == 0 ) {
467
+ basic . showString ( "SIM!" )
468
+ simWeather ( )
469
+ }
470
+ else {
471
+ basic . showString ( "ID=" )
472
+ basic . showNumber ( id )
473
+ }
474
+
463
475
// The 0xE5 register is 8 bits where 4 bits go to one value and 4 bits go to another
464
476
let e5Val = 0
465
477
You can’t perform that action at this time.
0 commit comments