MySQL for the Internet of Things
Chapter 4 ■ Data transformation ■Tip make a plan for how long you want to store the data. implement any purge events as backup o ...
Chapter 4 ■ Data transformation Recording the Sensor Name or Adding Notes The simplest form of annotation is adding a short stri ...
Chapter 4 ■ Data transformation void setup() { Serial.begin(115200); while (!Serial); Serial.print("Initializing SD card..."); i ...
Chapter 4 ■ Data transformation While this example shows how to save the sensor name with the data, it would be equally easy to ...
Chapter 4 ■ Data transformation like Listing 4-3. Don’t worry about knowing what all the parts of the command are; just focus on ...
Chapter 4 ■ Data transformation An RTC is needed to ensure accurate time keeping because the clock (a special crystal or similar ...
Chapter 4 ■ Data transformation There is a bit of code needed to initialize the RTC, but it isn’t difficult. First, we must down ...
Chapter 4 ■ Data transformation Listing 4-4. Date and Time Annotation (Arduino) String get_datetime() { DateTime now = rtc.now() ...
Chapter 4 ■ Data transformation If you want to do something similar in Python and your platform has an RTC on board, the code is ...
Chapter 4 ■ Data transformation Database Considerations Saving a date and time in a row for a database is possible in one of two ...
Chapter 4 ■ Data transformation Notice the additional options after the DEFAULT option. These are added by default, and it shows ...
Chapter 4 ■ Data transformation integer and an unsigned integer may be the same size^3 (2 bytes), but the range of values is dif ...
Chapter 4 ■ Data transformation And here is the output (from the serial monitor): 1> 65535 65535 2> 0 65536 3> 1 65537 ...
Chapter 4 ■ Data transformation Code Implementation While most experienced programmers would caution against converting data typ ...
Chapter 4 ■ Data transformation Thus, to retrieve a value from the byte stream, you must read one byte at a time shifting each b ...
Chapter 4 ■ Data transformation * Returns integer - integer from the buffer / int read_int(byte buffer[], int offset, int size) ...
Chapter 4 ■ Data transformation ■Note this code is meant to be an example of how to encode and decode. if you want to use this i ...
Chapter 4 ■ Data transformation For example, MySQL provides additional controls for floating-point data types. That is, you can ...
Chapter 4 ■ Data transformation The third is another example of a derived value where we want to store the difference of the val ...
Chapter 4 ■ Data transformation } else { if (random(25) >= 5) { return (float)random(14)/10.00; } else { return -(float)rando ...
«
2
3
4
5
6
7
8
9
10
11
»
Free download pdf