|
| ||||||||||||
|
www.RoboHobby.comJava ME source code examples for cell phone robot
Java ME Source code examples
Recently we reviewed our code of www.RoboHobby.com project and we decided to public some code examples. On this page you can see soma simple code samples of Java ME part of the project, which may be useful for robot builders. There are a lot of J2ME code examples in the Internet. But this set of code examples are specific. The code is for those, who want to use Java (mainly Java ME) as a base language for creating robot's brain. They show our step-by-step progress, starting from most simple examples to more complecated. In fact you can think of this code as am education material. The code was written by me or by my son in education process. In 2004-2006 I was trying to teach my son Java. Now I think it is time to share my experience and public some code on my site. How there will be the day when it will be possible to public all the code of the project. Sorry, but it is not ready yet to be published. I should prepare it for the public. By the way, I am looking for a way to public source code on the web in good readable form. I mean there must be the way how to convert Java source code to good formated HTML with color highlights. I mean comments should be gray, code should be black, key words should be green, variables should be blue, for example, etc. If you know any Java tool something like JavaDoc, XDoclet, TagLet, etc, which can solve this problem (transfprmation from Java source code to HTML with text of Java code), please, send me message. All example projects were reconstructed from their original form (JDK 1.4.2, Netbeans 4.0, etc.) to modern form. Now all the examples are re-written for Netbeans 6.5 with Java 1.6. All of them are ready to be used and tested with Siemens S75 cell phone.(CLDC-1.1, MIDP-2.0). I am sorry for so short description of these project. Hope I will find the time for detailed description with illustrations (print screens, etc.). See also: Run Java ME Code Examples First simple example is Java ME Timer Java ME Timer JavaDoc www.RoboHobby.com_Java_ME_Timer.zip Timer is one of the key feature of Java ME based hobby robot. Theoretically it is possible to run threads on cell phones, but practically these threads are very specific. You can not do a lot of things, which you can do with Java SE. Practically we should not run a lot of parallel threads in Java ME. In real life it is better to use timers then work with threads. To use this simple project you should download zip file from our server. Unzip it to your PC, for example to C:\www.RoboHobby.com_Java_ME_Timer Then open Netbeans 6.5 and point it to the directory (File/Open Project). Then you can compile it, build, generate JavaDoc, etc., using Netbeans. Note: After the compilation (Clean&Build) you can see resulting jar and jad files in the directory 'Timer'. This folder (Timer) you can put to your 'Application' directory on your phone. And run it there. Also this project you can run right in the Netbeans IDE. It works there. Next project is Java ME Disc
Java ME Disc JavaDoc www.RoboHobby.com_Java_ME_Disc.zip This project illustrates how to write information as a file to file system of your telephone. It is also important for robot project. Using this feature you can save o n local disc (in constant memory or on removable card (SD, RS MMC, etc.) some information, like images, sensor information, some other info, got on the road, like navigation info, etc. Using this project you can view roots of your phone's file system. Client-Server Project 'Java ME Http'
Java ME Http JavaDoc www.RoboHobby.com_Java_ME_Http.zip Robot should be able to communicate with web server via GPRS+Internet. This simple project read string from web server. In our case it is just server Date/Time in Java format. Java ME Image Shooting
Java ME ImageShooting JavaDoc www.RoboHobby.com_Java_ME_ImageShooting.zip Robot should be able to see, where it is going. It should be able to do snap shots, using embedded camera. Java ME Saving Image on Local Disc
Java ME ImageDisc JavaDoc www.RoboHobby.com_Java_ME_ImageDisc.zip Robot should be able to save images in the cell phone file system. Java ME Image Timer
Java ME ImageTimer JavaDoc www.RoboHobby.com_Java_ME_ImageTimer.zip This project is able to do snap-shots periodically, using timer and save images on the local disc. Java ME 'Disc Command' example
Java ME DiscCommand JavaDoc www.RoboHobby.com_Java_ME_DiscCommand.zip Using this project you can test simple way of sending commands to cell phone. If you install this application, run it and then put file 'cmd.txt' with letter 'C' (means 'capture') to directory /MMCard/Pictures/DiscData/ then the application will read it, do one snap-shot and then save it on the local disc of cell phone. That means you can put the cell phone with running program in one place (in one room for example) then connect to cell phone, using standard PC Bluetooth software (from another room) and put 'cmd.txt' file in local file system of the phone and do one shoot. Then you can get image from /MMCard/Pictures/DiscData/ directory remotelly. :-) Sorry for so short description. I will add more details soon. Contact us:
|
|
||||||||||