Are you looking for a simple code for IoT Foundation ? Try the following links:
Explore MQTT and the Internet of Things service on IBM Bluemix : This is a sample Java program for the device and the application which uses IoT Foundation service. Since this doesn’t require any actual hardware ( the device and the application are both Java program ), it is better for you to study IoT Foundation service.
MQTTとアンドロイドで本格的IoTを体験しよう ( Sorry that this is for Japanese . ) : This is a sample code for your android phone to connect to IoT Foundation by using Node-Red.