12 Mission Instructions
6. Code: Logging
To log information, you’ll notice that we first named the file that will get downloaded onto our USB drive. We chose “log3” for our example, but you might name it “Earthquake1”. Definitely include a 1 at the end of your number, because every time you run your program, it will download a new file onto your USB drive, so we’ll change the name between every test. “Earthquake1”, “Earthquake2”, “Earthquake3”, etc.
(The pictures we’re sharing are from our third attempt at solving this challenge - and I’ll let you in on a little secret. It took us more than three tries, but sometimes we forgot to update the name of our file in between tests! We’re all human!)
Let’s remember some of the basics we’ve learned over the past year:
- Computers only do exactly what you tell them to do.
- Computers can do lots of steps very quickly.
- Computers can gather more information that what we, as humans, can reasonably process.
SO - if we just add the command for the robot to Log “Z” in “sensor readings” (image 1), it will only do that one time, right at the beginning, and never do it again. That probably won’t be the most useful earthquake detector.
You probably already guessed it, we’ll need to add in a loop. For our example code, we chose a time loop and randomly chose 2 minutes as our testing duration.