Assignment for Tue 10/6: ----------------------- (1) Read the introduction and Chapters 1-2 from Asimov's _I, Robot_ collection. Consider the questions below, and be prepared to discuss the stories. Everyone will be expected to partiticipate and will receive a score based on their contribution to our in-class discussion. -What kind of groups or organizations might be opposed to Robots? -Why does Robbie always want Gloria to tell him the story of Cinderella? -What would you guess is Asimov's position on humanity and its future? -Describe the relationship between robots and humans as portrayed in the stories. What sorts of details support your hypothesis? Think of other interesting questions as you are reading. ----------------------- -We talked a little more about the lejos API -We talked about how variables and object variables work (how they differ): // variables with a fundamental data type are simply like a box which stores a value int x = 2; // create variable x and store binary representation of "2" in it boolean b = true; // create variable b and store binary representation of "true" in it // object variables don't quite work the same way TouchSensor ts; // create a variable which will eventually hold a reference to an object ts = new TouchSensor(SensorPort.S1); // actually create a TouchSensor object and store reference to it The variable ts does not actually contain the TouchSensor object created by "new," but rather it stores a reference to it. The analogy is that if you get a package, your post office box will not contain the actual packge, but a reference to it (e.g. a note telling you where you may pick it up). -We finished our USTest program, which tests the ultrasonic sensor -It turned out that displaying a simple continuous reading of the US sensor is nontrivial, and we encountered several hurdles -The first hurdle was that the US only works properly on ports 1-3; port 4 is special -The second was that we saw something like the following on the LCD: 255 205 195 325 The numbers were much larger than we expected (and always ended in 5) -It turned out that the last "5" from the 255 wasn't being erased, so that 20 showed up as 205 -We fixed this by using the LCD.clear() method -Next we barely saw anything but brief flashes on the screen -It turned out the numbers were being displayed too quickly, so we added a delay: drawInt(dist, 0, 3); // draw value of dist on line 3 LCD.clear(); // clear display Thread.sleep(200) // wait 200 ms = 1/5 second -Next we saw nothing; it turned out that we added our delay in the wrong place drawInt(dist, 0, 3); // draw value of dist on line 3 Thread.sleep(200) // wait 200 ms = 1/5 second LCD.clear(); // clear display We need to pause before we clear the display, so we have time to see the value of dist. -Finally we broke up into groups of 2 and had a quiz.