Overview
Milkcocoa is a cloud-based platform which enable us to exchange data in real time, its service is provided by Uhuru Technical Rockstars.
Let’s go through a tutorial for Milkcocoa. For this tutorial, we will put a GR board and ESP8266 Wi-Fi module together.
Preparation
For GR-CITRUS
Connect it with a WA-MIKAN board which can be purchased at Akizukidenshi.com.
ESP8266 modules can be used with the same example program.
For GR-SAKURA, GR-KAEDE & GR-PEACH
You will want to get the ESP8266 module ready and connect TX and RX signals for serial communication. The example connected to GR-SAKURA is as follows. Set IO15 pin at Low, EN pin at High, since the ESP8266 is used with an AT command mode.
Creating the Application with Milkcocoa
Log in and create the application to use the Milkcocoa service. Be sure to check out the Milkcocoa Tutorial for some helpful tips.
1. Login
Please note that it is necessary to create an account to login.
2. Creating an Application
Push the button to create an application with a suitable name. The image to the right shows the application named "GR".
3. Copy of app_id
The application overview is displayed when the created application is clicked. Cloud access will be gained based on the information of this screen. Don’t forget to copy the "app_id" for later use.
Access to Milkcocoa
Making a Project
With the library to access Milkcocoa in the template on the web compiler, let’s make a project.
Editing the Sketch Program
Open gr_sketch.cpp and edit four shown below. Then, let’s build and write cotton_sketch.bin at GR-COTTON.
- ESP_Serial: Serial communication number, refer to the pin map.
- WLAN_SSID: Access point SSID
- WLAN_PASS: Password at the access point
- MILKCOCOA_APP_ID: The app_id for the application created with Milkcocoa
- MILKCOCOA_DATASTORE: Suitable element name, temporarily MILK_COTTON here
Operation Check
After writing the sketch program, let’s check it with serial monitors such as Teraterm. In the case of GR-SAKURA and/or GR-CITRUS, please note that sometimes it may not start unless you press the enter key on your keyboard after the monitor starts. Please find the successful example of the access to Milkcocoa in the image to the right, 「onpush」and/or「v:**」displayed in the end of display.
In this case, the GR board send out temperature data to Milkcocoa every seven seconds and then displayed them in the monitor when a notice came from Milkcocoa. It means, if several GR boards connect to Milkcocoa, they can receive notices at the same time.
Let’s check the Milkcocoa datastore to see it uploading {"v":**} every seven seconds.
Let’s Try to Operate the GR Board on a Web Browser
Please refer to an example of an operating GR board through a web browser on the GR-COTTON Special Project: Cloud Access with Milkcocoa! page.