Response of analogWrite Function

In the documentation under the GPIO commands part (, it is stated that whenever the analogWrite function will be run then in the response we will get a JSON object which will have 02 attributes: success and value.

It clearly mentions that while success gives the information about whether the command was exceuted perfectly or not and the value will have the numerical value which was passed at the time of calling the analogWrite function. Say I have written the following code: analogWrite(‘0’,‘240’) then after successfull execution of the command the JSON obejct should look like this: {“success”:“1”, “value”:“240”}.

But in my case when I try the same command in the UBUNTU OS (that is via the python code) then the JSON obeject doesn’t have the numerical value that I passed in the function. The response will be like this: {“success”:“1”, “value”:“1”} Why this is so?

I am attaching the screenshot of the output and the code.

Same problem is with the digitalWrite function, means for the Read function the JSON object is okay but for the Write functions the value is always 1 or 0.

In the dicumentation it is clearly specified that we must get the value which we have entered at the time of calling that function.

Please solve my query @rahul.singh1

@yeshwant.naik @rahul.singh1 Sir, please look into my query

@rahul.singh1 @yeshwant.naik Sir almost 2 days have elapsed since I posted my query. Still not getting any response from the team. Please look into the matter

Hi @vishalvats2000,

Apology for the delay, I am looking into this and will sharing the update by tonight.

Do let me know in case you need any other information.

Okay sir. Thanks for the assurance

Hi, @vishalvats2000,

In the initial investigation,

  1. When you are writing something using Bolt Cloud API (GPIO) for example - digitalWrite or analogWrite the response would be -

{“success”: “numerical value”, “value”: “numerical value/string”}

  1. Here success is the status of the request
  2. and value could be either command status or error message

For example:

Suppose you are sending the below request

If the request status and command status both are successful, then the response would be

{"success": 1, "value": "1"}

There is no point in returning the same value as a response that you are passing inside the request parameter.

Suppose the device is offline and you are sending the analogWrite command, then the response would be -

{"value": "Device is offline", "success": 0} 

It seems that documentation is incorrect here I will discuss this with the team and update the documentation accordingly.

Do let me know in case you need any other information.

1 Like

Thanks sir, please make sure that the Documentation is restored :slight_smile: