In the future, interaction between humans and personal roots will become increasingly important as robots will, more and more, operate as assistants in our everyday life. Because of this, there is a need for a convenient, flexible, and general-purpose technique that we can use to interact with robots. Moreover, the same technique should also be usable when we interact with embedded systems in smart environments. In this paper, we will describe a technique that allows us to use a single simple handheld control device to interact not only with personal robots, but also with ubiquitous embedded systems. When a new system, whether a mobile robot or a VCR, is encountered, the control device downloads a mobile code from the system and executes it. The mobile code then sues the services provided by the control device to create a virtual user interface that we can use to interact with the particular syste. Our technique is flexible, simple, adaptive, and open. The technique draws much of its flexibility and simplicity from the mobile code. Adaptivity comes from the fact that the control device only needs minimal knowledge about each particular system. In addition, the technique does not place any restrictions on the type of mobile code that can be used. We will describe the architecture of the CUES system that utilizes our technique. We will also describe the architecture of the SMAF system, our test bed mobile code execution environment used in CUES. In addition, we will present a virtual user interface for a mobile robot that we can use to control the robot and to monitor its status information. The interface also operates as a terminal that we can use to access remote information in the Internet.