Stap 3: De database
Om te redden van de gegevens van de sensoren zullen we een MySql-database instellen.
In dit geval zijn er 2 tafels: sensor_log en gebruikers.
CREATE TABLE `sensor_log` ( `id` smallint(6) PRIMARY KEY AUTO_INCREMENT, `timeStamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `temp_0` float DEFAULT NULL, `hum_0` float DEFAULT NULL, `temp_1` float DEFAULT NULL, `hum_1` float DEFAULT NULL, `temp_2` float DEFAULT NULL, `hum_2` float DEFAULT NULL, `light_0` float DEFAULT NULL, `light_1` float DEFAULT NULL, `light_2` float DEFAULT NULL, ); CREATE TABLE `users` ( `username` char(30) PRIMARY KEY, `password` char(50) NOT NULL UNIQUE, `is_connected` tinyint(1) NOT NULL DEFAULT '0', );