Page 267 - Hacking Roomba
P. 267

248       Part III — More Complex Interfacing




                     Controlling Roomba through a Web Page


                             Roomba is now on a wireless network, but to make it usable, it needs something external to
                             send it proper ROI commands. You could use RoombaComm as you’ve done previously, but
                             network accessibility opens up an entirely new space to play in. On the Internet there are pro-
                             gramming languages that normally don’t touch hardware, but now you control Roomba with
                             them. Some of those languages are part of the LAMP web application platform. You can create
                             a dynamic web page to control Roomba and have that page live anywhere on the Internet that
                             has a LAMP-compatible server.

                             LAMP

                             LAMP is a suite of open source tools connected together to create dynamic web sites. It usually
                             stands for Linux, Apache, MySQL, PHP, but P can also stand for Perl or Python. The great
                             thing about LAMP is that it’s more of a methodology than a specific set of technologies.
                             Different pieces can be added or swapped around as the need arises. In fact, the LAMP philos-
                             ophy isn’t bound to Linux. There is also WAMP for Windows and MAMP for Mac OS X.
                             For the following purposes, PHP on Apache will be used as the basic arrangement. The term
                             LAMP will be used to refer to all similar setups, unless there are some WAMP- or MAMP-
                             specific configuration issues.
                             The components of LAMP are part of every modern Linux distribution. To get WAMP for
                             your Windows box, visit www.wampserver.com/. To get MAMP for Mac OS X, visit
                             www.mamp.info/.


                             Both PHP and Apache will tell you when something is amiss by writing the errors to special
                             log files. When debugging web programs, one of the easiest and most instructive techniques
                             to find problems is to watch these files. This is sometimes called tailing the logs after the Unix
                             practice of typing tail -f logfile. The tail -f command shows the last few lines of a file
                             and will follow the end of the file as more is written to it. In LAMP environments the two
                             most important logs are:

                                 error_log: The Apache error log. This shows web site configuration and page
                                 access errors.
                                 php_error_log: The PHP error log. This shows syntax and execution errors for
                                 PHP pages.
                             In MAMP systems both of these logs are located in /Applications/MAMP/logs. In
                             WAMP systems both are located in C:\WAMP\logs. Various Linux distributions put the
                             logs and other components in different locations.
   262   263   264   265   266   267   268   269   270   271   272