IoT Challenge¶
Take a look at the IoT Challenge: Data Logging in Python section of the files tutorial and try to add some data logging features to your Arduino project. Remember to write down the main conclusions of your experiments in your IoT Challenge journal!
Analysis questions and exercises¶
Try the exercise 3 of the follow-along tutorial several times. What happens if you try to open the file while it is opened in the
forloop? How can you modify the code so that it appends new lines with new biometric sensor readings everytime you execute it?
[ ]:
Put together the exercises 1 and 3 of the follow along to write this program: Ask the patient for basic information (name, surname, age, gender). Once you have collected information, use randint to simulate that you are taking biometric information from the patient. Store all the information in a json file, including the personal data and the biometric sensor records of the patient in a nested array where each row is a new sensor reading. Your json file should look something like this:
{
"name": "John",
"surname": "Wick",
"age": 49,
"gender": "Male",
"biometric_records": [["2023-10-12 09:36:03", 94.81133685445278, 15.741375425586417, 38.29073003474125],
["2023-10-12 09:36:04", 62.43879955763823, 15.196150080344506, 36.35115512937469],
["2023-10-12 09:36:05", 84.2956911357949, 16.874367511552123, 38.601030883538705],
["2023-10-12 09:36:06", 90.92783941838005, 15.243397358464172, 38.20701718801453],
["2023-10-12 09:36:07", 66.98236238953217, 15.84866472378154, 38.701768958838265],
["2023-10-12 09:36:08", 72.99941898004641, 15.513105218093163, 38.102228689549705],
["2023-10-12 09:36:09", 77.08888377029628, 15.021590488883383, 36.66202689844145],
["2023-10-12 09:36:10", 68.74352689548292, 16.584930430921066, 36.40565233779666],
["2023-10-12 09:36:11", 82.60106652493903, 15.852897058076554, 38.43021287171804],
["2023-10-12 09:36:12", 93.29091818500198, 16.14095737493462, 37.20321563654275]]
}
Load the file you just created and use indexing to calculate the average heart rate in the monitoring period.
[ ]: