IoT applications are fast growing recently. One of the "things" that has a lot of potential is the lighting equipment since it is widely used in our daily life. Recently, the technology of visible light communication (VLC) has been widely discussed. VLC has several advantages, such as freedom of license, line-of-sight security, and less health concern compared to radio-based systems. In addition, the rapid progress of light emitting diode (LED) technology by solid-state lighting allows VLC to be easily deployed and integrated with existing lighting infrastructure at low costs. However, VLC, when integrated with lighting infrastructure, is usually for one-way communication and is highly sensitive to external interfering light. Thus, transmitting or broadcasting multiple messages simultaneously over a visible light channel without any preprocessing may result in serious collisions. In this paper, we propose a framework to tackle these problems by optical code division multiple access (CDMA) for VLC. With our approach, a VLC receiver can enter an environment without any prior configuration and can be designed with simple hardware. Even a mobile device with a high-resolution photodiode sensor can be used as a receiver. We demonstrate an application of indoor positioning by querying the location service provider on Internet with the IDs decoded from the received light signals. The prototyping results reveal some communication properties of CDMA-based VLC and its potential for indoor positioning applications.Index Terms-broadcast, CDMA, IEEE 802.15.7, localization, pervasive computing, visible light communication.