digitalRead in While()

does the digitalRead in the following line refresh with each iteration?

I have the above statement in a while loop but once I read from a pin it looks like the next I/P is not picked from the same pin in next iteration.

I am using python script. Please help

Hi ,
Yess, Give some delay in each digtialRead Request because bolt takes some time (in milliseconds) to process the request on the same pin.
Refer this code snippet.

import json
import time
import requests

while True:
        # Replace api_key with your api key that you will get from bolt cloud
        # Replace device_name with your original device name
        response = requests.get('')
        data = json.loads(response.text)
        print data['value']
1 Like

Thanks, Rahul. Appreciate your help.

But what if I have input at much faster rate? Like I have inputs in millisec intervals…

@pruthvikrishna currently the Bolt commands take a few seconds for the data retrieval since the command first goes to the Bolt cloud, which in turn sends the command to the Bolt device, following which the Bolt device sends the data to the Bolt Cloud which sends it to the browser. We are working on reducing the latencies but currently, it will at least take you 1 to 2 seconds to retrieve the data.

1 Like

Hi @pruthvikrishna

Even if we reduce the the time for reading to Milliseconds, such application are always dependent on the inherent latency of the Internet. hence the monitoring application your looking to do is a valid case, but not an ideal IoT application. Its more on the lines of Automation.