Page 362 - Hacking Roomba
P. 362

Chapter 15 — RoombaCam: Adding Eyes to Roomba                     343




                               Listing 15-1 Continued

                               function refreshIt() {
                                   if (!document.images) return;
                                     document.images[‘SpcaPict’].src =
                                                            ‘SpcaPict.tif?’ + Math.random();
                                     setTimeout(‘refreshIt()’,2000); // call again in 2000
                               msec
                                }
                               //-- >
                               </script>
                               </head>
                               <body onLoad=”setTimeout(‘refreshIt()’,5000)”>
                               <center>
                               <h2> Roomba Camera </h2>
                               <img src=”SpcaPict.tif” name=”SpcaPict”>
                               <br/>
                               Image refreshed every 2 seconds.
                               </center>
                               </body>
                               </html>





































                             FIGURE 15-8: An auto-refreshing webpage for the Roomba webcam
   357   358   359   360   361   362   363   364   365   366   367