Copyright ©

Mongoose OS Forum


Basic code structure in C or Javascript

I am working on ESP8266 Nodemcu devboard. My working would be based on collecting data from sensor and send these data to AWS IoT service using MQTT.
I have gone through various docs related to Mongoose OS. I have query that which is better for programming in Mongoose, using C or Javascript? (For fast prototyping)
Also,I have read quick start guide of Mongoose, but couldn't able to understand thoroughly. I want to know, what is the basic code structure in C or Javascript for Mongoose OS?
Please, explain me for this issue. I know already about APIs, Libraries provided by Mongoose.


  • SergeySergey Dublin, Ireland

    Hi Viraj!

    This video is a good reference on how you can do it.

    Both C and JS are OK for your task. Your choice.

    The basic code structure is shown in the examples,

    Could you elaborate more on the project you're working on, please? Is it personal, or commercial? Is there any other functionality, other than sending sensor data, present on the device?

  • Currently I am working on prototype, later on it will be used for commercial purpose. My project is on air quality monitor.
    Apart from sending sensor(SDS021) data to cloud, we are also implementing cloud based actuator(Air Purifier Machine) control mechanism. We are also developing app for easy accessibility for the customers. Also we are planning to use ESP32 instead of ESP8266 to get WiFi+Bluetooth functionality. So, networking functionality will be also implemented using Mongoose.

  • SergeySergey Dublin, Ireland

    Thanks for clarifying.

    The prototyping is easiest made with JS.

    So, the vanilla nodemcu, provisioned with AWS IoT, can talk to the cloud, for example being triggered by a button press. The video above shows how that is doable. A quite detailed instruction is at Please let me know that you can follow the same steps, and successfully talk to AWS IoT.

    The following step would be to attach a sensor to the board, trigger sensor reading by a button press, and send the reading to the cloud - directly to the AWS Lambda function. Please confirm we're on the same page.

  • Thanks @Sergey
    I start working on this and will update you.

Sign In or Register to comment.