MySQL for the Internet of Things
ChapTEr 8 ■ DEmonsTraTion of high availabiliTy TEChniquEs self.cur_server_id = id conn = mysql.connect(**master) cur = conn.curs ...
ChapTEr 8 ■ DEmonsTraTion of high availabiliTy TEChniquEs Notice we have the connection information for the master that we use t ...
ChapTEr 8 ■ DEmonsTraTion of high availabiliTy TEChniquEs High Availability IOT Nodes You have seen a number of techniques using ...
ChapTEr 8 ■ DEmonsTraTion of high availabiliTy TEChniquEs On the I2C bus, one device is designated as a write and the other a re ...
ChapTEr 8 ■ DEmonsTraTion of high availabiliTy TEChniquEs ■Tip if you want to power the arduino boards with a single power suppl ...
ChapTEr 8 ■ DEmonsTraTion of high availabiliTy TEChniquEs images courtesy of sparkfun.com. Write the Sketch The example code is ...
ChapTEr 8 ■ DEmonsTraTion of high availabiliTy TEChniquEs elapsedTime = 0; else Wire.begin(); endif pinMode(13, OUTPUT); // turn ...
All that is left now are the details of communicating with the serial monitor, timer expiration, and blinking the LED—all of whi ...
ChapTEr 8 ■ DEmonsTraTion of high availabiliTy TEChniquEs Serial.println("Master is ok."); // Reset timer since master is Ok sta ...
// Record data since master is dead. recordData(); } else recordData(); // read and save data Serial.print("Sending heartbeat... ...
ChapTEr 8 ■ DEmonsTraTion of high availabiliTy TEChniquEs Next, when you connect to the slave, you should see messages that depi ...
You should also consider uploading the master sketch and leaving it running while you upload the slave sketch and then connect t ...
ChapTEr 8 ■ DEmonsTraTion of high availabiliTy TEChniquEs Overview of the Design The goal is to make the node fault tolerant of ...
But wait! Why are we using an Arduino Mega? This is one of those times that we see just how resource- intensive fault detection ...
ChapTEr 8 ■ DEmonsTraTion of high availabiliTy TEChniquEs Data saved to the local file should be written to the onboard SD card ...
You have also seen how to read data from the file, but not in a way that resulted in inserting the data in the database. But mec ...
ChapTEr 8 ■ DEmonsTraTion of high availabiliTy TEChniquEs define LOGFILE "cache.txt" // name of log file for caching data int se ...
Serial.println("ERROR: Cannot open file for writing."); return false; } // Save the data to the database bool write_data(int val ...
ChapTEr 8 ■ DEmonsTraTion of high availabiliTy TEChniquEs // Write the row to the database write_data(val, buffer); } } // close ...
// Setup the network connection Ethernet.begin(mac_addr); delay(1000); // Test the connection Serial.println("Testing connection ...
«
8
9
10
11
12
13
14
15
16
17
»
Free download pdf