[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:00.64,0:00:02.16,Default,,0000,0000,0000,,to make my door alarm I've got a new Dialogue: 0,0:00:02.16,0:00:04.00,Default,,0000,0000,0000,,make code project let's get rid of the Dialogue: 0,0:00:04.00,0:00:05.76,Default,,0000,0000,0000,,on start block but we're going to keep Dialogue: 0,0:00:05.76,0:00:07.12,Default,,0000,0000,0000,,the forever block because we're going to Dialogue: 0,0:00:07.12,0:00:09.08,Default,,0000,0000,0000,,keep checking the magnetic field Dialogue: 0,0:00:09.08,0:00:11.64,Default,,0000,0000,0000,,measured by the microbits magnetometer Dialogue: 0,0:00:11.64,0:00:12.84,Default,,0000,0000,0000,,its Dialogue: 0,0:00:12.84,0:00:16.20,Default,,0000,0000,0000,,Compass go to logic and find the if Dialogue: 0,0:00:16.20,0:00:19.20,Default,,0000,0000,0000,,block and drag that in and also in logic Dialogue: 0,0:00:19.20,0:00:21.20,Default,,0000,0000,0000,,you'll find the comparison block so get Dialogue: 0,0:00:21.20,0:00:23.24,Default,,0000,0000,0000,,that hexagonal block and drop it on top Dialogue: 0,0:00:23.24,0:00:24.52,Default,,0000,0000,0000,,of Dialogue: 0,0:00:24.52,0:00:27.80,Default,,0000,0000,0000,,true then if we go to input and click on Dialogue: 0,0:00:27.80,0:00:29.96,Default,,0000,0000,0000,,more you'll find a block called magnet Dialogue: 0,0:00:29.96,0:00:33.64,Default,,0000,0000,0000,,magnetic force drop it in the first Hole Dialogue: 0,0:00:33.64,0:00:36.32,Default,,0000,0000,0000,,In the comparison block and we're going Dialogue: 0,0:00:36.32,0:00:39.32,Default,,0000,0000,0000,,to change it so it measures the overall Dialogue: 0,0:00:39.32,0:00:41.44,Default,,0000,0000,0000,,strength of the magnetic force your Dialogue: 0,0:00:41.44,0:00:43.12,Default,,0000,0000,0000,,microbits magnetometer can measure Dialogue: 0,0:00:43.12,0:00:44.92,Default,,0000,0000,0000,,magnetic force in different dimensions Dialogue: 0,0:00:44.92,0:00:47.20,Default,,0000,0000,0000,,but we're just interested in just how Dialogue: 0,0:00:47.20,0:00:49.40,Default,,0000,0000,0000,,strong it is overall and we're going to Dialogue: 0,0:00:49.40,0:00:50.96,Default,,0000,0000,0000,,pop a number in here that we might need Dialogue: 0,0:00:50.96,0:00:52.48,Default,,0000,0000,0000,,to change later but I'm just going to Dialogue: 0,0:00:52.48,0:00:55.12,Default,,0000,0000,0000,,pick 200 for the moment it measures the Dialogue: 0,0:00:55.12,0:00:56.76,Default,,0000,0000,0000,,strength of magnetic field in a unit Dialogue: 0,0:00:56.76,0:00:59.48,Default,,0000,0000,0000,,called micro Teslas and I'm going to try Dialogue: 0,0:00:59.48,0:01:01.52,Default,,0000,0000,0000,,200 to to start with if the magnetic Dialogue: 0,0:01:01.52,0:01:05.36,Default,,0000,0000,0000,,field Falls below 200 micro Teslas I'm Dialogue: 0,0:01:05.36,0:01:08.40,Default,,0000,0000,0000,,going to show an angry face because what Dialogue: 0,0:01:08.40,0:01:10.20,Default,,0000,0000,0000,,that will mean is the magnet has gone Dialogue: 0,0:01:10.20,0:01:12.04,Default,,0000,0000,0000,,away from my microbit somebody's opened Dialogue: 0,0:01:12.04,0:01:14.68,Default,,0000,0000,0000,,the door and uh we want to know Dialogue: 0,0:01:14.68,0:01:15.88,Default,,0000,0000,0000,,someone's been in the room so it's going Dialogue: 0,0:01:15.88,0:01:18.12,Default,,0000,0000,0000,,to show an angry face on the Dialogue: 0,0:01:18.12,0:01:20.80,Default,,0000,0000,0000,,display how do I know what number to Dialogue: 0,0:01:20.80,0:01:22.52,Default,,0000,0000,0000,,pick for the magnetic force how do I Dialogue: 0,0:01:22.52,0:01:24.28,Default,,0000,0000,0000,,know how strong my magnet is well we're Dialogue: 0,0:01:24.28,0:01:26.32,Default,,0000,0000,0000,,going to do something to sort that out Dialogue: 0,0:01:26.32,0:01:29.36,Default,,0000,0000,0000,,so if we go to input drag in on button a Dialogue: 0,0:01:29.36,0:01:30.84,Default,,0000,0000,0000,,press Dialogue: 0,0:01:30.84,0:01:33.60,Default,,0000,0000,0000,,and we'll add a show number block and Dialogue: 0,0:01:33.60,0:01:36.04,Default,,0000,0000,0000,,let's copy the magnetic force block if I Dialogue: 0,0:01:36.04,0:01:38.76,Default,,0000,0000,0000,,right click on it duplicate and drag it Dialogue: 0,0:01:38.76,0:01:40.68,Default,,0000,0000,0000,,in here and drop it there what this Dialogue: 0,0:01:40.68,0:01:43.48,Default,,0000,0000,0000,,means now is that when I press button a Dialogue: 0,0:01:43.48,0:01:45.52,Default,,0000,0000,0000,,I can measure the amount of magnetic Dialogue: 0,0:01:45.52,0:01:47.76,Default,,0000,0000,0000,,force measured by my microbit I can see Dialogue: 0,0:01:47.76,0:01:48.80,Default,,0000,0000,0000,,it on the Dialogue: 0,0:01:48.80,0:01:51.92,Default,,0000,0000,0000,,display so we're ready to try this out Dialogue: 0,0:01:51.92,0:01:53.72,Default,,0000,0000,0000,,now doesn't work in the simulator so Dialogue: 0,0:01:53.72,0:01:54.64,Default,,0000,0000,0000,,we're going to need to put this on a Dialogue: 0,0:01:54.64,0:01:57.08,Default,,0000,0000,0000,,real microbit so uh I'm going to call it Dialogue: 0,0:01:57.08,0:01:59.88,Default,,0000,0000,0000,,door alarm and I'm going to download the Dialogue: 0,0:01:59.88,0:02:03.76,Default,,0000,0000,0000,,hex file and transfer it to my microbit Dialogue: 0,0:02:03.76,0:02:05.68,Default,,0000,0000,0000,,I fix the microbit in the battery pack Dialogue: 0,0:02:05.68,0:02:07.32,Default,,0000,0000,0000,,to the door frame using something like Dialogue: 0,0:02:07.32,0:02:09.72,Default,,0000,0000,0000,,blue Tack and put the magnet on the door Dialogue: 0,0:02:09.72,0:02:11.80,Default,,0000,0000,0000,,itself very close to it have a look on Dialogue: 0,0:02:11.80,0:02:13.64,Default,,0000,0000,0000,,the back of your microbit board and see Dialogue: 0,0:02:13.64,0:02:15.40,Default,,0000,0000,0000,,where the compass is you need to make Dialogue: 0,0:02:15.40,0:02:17.60,Default,,0000,0000,0000,,sure the magnet is close to the compass Dialogue: 0,0:02:17.60,0:02:19.60,Default,,0000,0000,0000,,chip on the back of your Dialogue: 0,0:02:19.60,0:02:22.40,Default,,0000,0000,0000,,microbit now we can calibrate it with Dialogue: 0,0:02:22.40,0:02:26.00,Default,,0000,0000,0000,,the door closed press button a and get a Dialogue: 0,0:02:26.00,0:02:28.24,Default,,0000,0000,0000,,reading of the magnetic field strength Dialogue: 0,0:02:28.24,0:02:30.32,Default,,0000,0000,0000,,in my case it's around Dialogue: 0,0:02:30.32,0:02:32.60,Default,,0000,0000,0000,,453 microteslas Dialogue: 0,0:02:32.60,0:02:35.32,Default,,0000,0000,0000,,I'm then going to open the door and Dialogue: 0,0:02:35.32,0:02:37.64,Default,,0000,0000,0000,,press button a again and take a reading Dialogue: 0,0:02:37.64,0:02:41.40,Default,,0000,0000,0000,,with the door open it's 129 micro Teslas Dialogue: 0,0:02:41.40,0:02:43.08,Default,,0000,0000,0000,,now it can still measure some magnetism Dialogue: 0,0:02:43.08,0:02:45.00,Default,,0000,0000,0000,,don't forget the Earth is magnetic and Dialogue: 0,0:02:45.00,0:02:46.36,Default,,0000,0000,0000,,there are other things probably in my Dialogue: 0,0:02:46.36,0:02:47.96,Default,,0000,0000,0000,,house that are magnetic as well so the Dialogue: 0,0:02:47.96,0:02:49.68,Default,,0000,0000,0000,,microb bit is still picking up some Dialogue: 0,0:02:49.68,0:02:52.88,Default,,0000,0000,0000,,magnetic field so my number of 200 Dialogue: 0,0:02:52.88,0:02:55.72,Default,,0000,0000,0000,,should work pretty well if it's more Dialogue: 0,0:02:55.72,0:02:58.36,Default,,0000,0000,0000,,than 200 it means the door is shut which Dialogue: 0,0:02:58.36,0:03:00.24,Default,,0000,0000,0000,,sounds likely cuz with the door shut I Dialogue: 0,0:03:00.24,0:03:03.64,Default,,0000,0000,0000,,had 453 micro Teslas if it's below 200 Dialogue: 0,0:03:03.64,0:03:04.96,Default,,0000,0000,0000,,that probably means someone's open the Dialogue: 0,0:03:04.96,0:03:06.68,Default,,0000,0000,0000,,door in this case I know that when my Dialogue: 0,0:03:06.68,0:03:09.92,Default,,0000,0000,0000,,door is open I have 129 micro Teslas so Dialogue: 0,0:03:09.92,0:03:11.68,Default,,0000,0000,0000,,that should work okay now I should be Dialogue: 0,0:03:11.68,0:03:13.84,Default,,0000,0000,0000,,able to tell when someone open my door Dialogue: 0,0:03:13.84,0:03:17.04,Default,,0000,0000,0000,,an angry face will appear on my microbit Dialogue: 0,0:03:17.04,0:03:18.64,Default,,0000,0000,0000,,display and I'll know that somebody has Dialogue: 0,0:03:18.64,0:03:20.76,Default,,0000,0000,0000,,been in my room there are lots of things Dialogue: 0,0:03:20.76,0:03:22.36,Default,,0000,0000,0000,,you could do to this project to augment Dialogue: 0,0:03:22.36,0:03:24.08,Default,,0000,0000,0000,,it you could perhaps add a delay to give Dialogue: 0,0:03:24.08,0:03:26.28,Default,,0000,0000,0000,,yourself some time to get out the room Dialogue: 0,0:03:26.28,0:03:28.16,Default,,0000,0000,0000,,remember if you need to reset it you can Dialogue: 0,0:03:28.16,0:03:30.24,Default,,0000,0000,0000,,just press button a to show the magnetic Dialogue: 0,0:03:30.24,0:03:31.60,Default,,0000,0000,0000,,force again and that will clear the Dialogue: 0,0:03:31.60,0:03:33.92,Default,,0000,0000,0000,,angry face off the display on your Dialogue: 0,0:03:33.92,0:03:36.08,Default,,0000,0000,0000,,microbit uh maybe you could add an Dialogue: 0,0:03:36.08,0:03:38.40,Default,,0000,0000,0000,,audible alarm as well you could add a Dialogue: 0,0:03:38.40,0:03:41.48,Default,,0000,0000,0000,,music block so that when somebody opens Dialogue: 0,0:03:41.48,0:03:44.36,Default,,0000,0000,0000,,your door it makes an audible sound to Dialogue: 0,0:03:44.36,0:03:46.36,Default,,0000,0000,0000,,warn you that somebody has been inside Dialogue: 0,0:03:46.36,0:03:48.20,Default,,0000,0000,0000,,your room there are all sorts of ways Dialogue: 0,0:03:48.20,0:03:50.92,Default,,0000,0000,0000,,you could modify this Dialogue: 0,0:03:50.92,0:03:53.92,Default,,0000,0000,0000,,project