

Make the Arduino chill out a little by adding a one second delay to the sketch, so that it only prints out Hello World once a second. The data is being transmitted so fast, that we can't see the TX LED 's sending data many times a second! What's going on here? Hint: Remember lesson 2?.Try waving the Arduino around in a dark room, what do you see?.You will see Hello World! scroll by super fast! Perform this modification and then compile and upload the new hyper-hello sketch. Simply move the Serial.println("Hello world!") statement from the setup procedure to the loop procedure. What simple modification should we perform to make the Arduino print Hello World over and over again?.Instead of printing out Hello World just once, we'd like it to print it out over and over and over again.

Our next sketch will be a minor modification of this one. Good, now compile the sketch and upload it to your Arduino.

This is twice as fast as before, so it will take half the time, about 1/200th of a second. If the Arduino transfers data at 19200 bits per second (19200 baud) and you're sending 12 bytes of data, how long does it take to send over this information?.If we can transfer 9600 bits per second, then 96 bits takes 1/100th of a second! If the Arduino transfers data at 9600 bits per second and you're sending 12 bytes of data, how long does it take to send over this information?ġ2 bytes of data equals 12 * 8 = 96 bits of data.We use two "'s (double quotes) to indicate the beginning and end of a line of text. This time the input is a quotation, the line of text we would like it to print. Note that the 6th letter in println is the letter L not the number 1. This line also uses the Serial library, this time it's calling a procedure called println which is just a shorthand for "print line". Serial.println( "Hello world!") // prints hello with ending line break How much less storage do you get thanks to the marketing guy who came up with this trick? Given this fact, how many bytes can you really store in your 200GB drive? Hard drive makers are quite sneaky, you'll notice that they define GB as being 1000 MB, and 1 MB = 1000 KB, etc. If your hard disk is 200 Gigabytes, how many bytes is that? Use a calculator with lots of digits!Ģ09715200 KB * 1024 = 214748364800 bytes! That is, a 1.0 Kilobyte file on your computer is 1024 bytes: You can group bits together into 8 bits which is 1 byte.ġ024 bytes (8192 bits) is one Kilobyte (sometimes written KB).ġ024 KB (1048576 bytes) is one Megabyte (MB)Īn interesting thing to note is while 1000 grams is a kilogram, nearly all computer systems consider 1024 bytes to be a kilobyte. Information has its own system of measurements: For example, we measure weight with "ounces" and "pounds" (or grams and kilograms) and distances with "inches," "feet," and "miles" (or centimeters, meters and kilometers). Now is a good time to review how data is measured. It's run by little ones and zeroes, little bits of data. If I use only Product objects to add to Stock everything works fine.The world isn't run by weapons anymore, or energy, or money. The reading of the object after Juice starts with the rest of Juice information, so I got CArchiveException in Serialaize method of Product. While reading objects from file Juice objects are read like Product (without volume ant taste fields). If (!in.Open(fname.c_str(), CFile::modeRead)) If (!out.Open(fname.c_str(), CFile::modeWrite | CFile::modeCreate))įor (auto it = stock.begin() it != stock.end() ++it) In Save and Load methods I'm trying to implement serialazation (according to discussion in this topic C++ MFC Serialization). To store objects of the classes I have Stock class which has container of Product class pointers. Void Serialize(CArchive& archive) override Virtual void Serialize(CArchive& archive) class Product : CObjectĭECLARE_SERIAL(Product) //IMPLEMENT_SERIAL(Product, CObject, 0) in. I need to implement MFC Serialazation for these classes. I have two classes: Product and derived Juice.
