Unexpected Behavior of my Bolt Device

import os

import time

from boltiot import Bolt

device_id = os.environ.get('DEVICE_ID') # os.environ is a dictionary

api_key = os.environ.get('API_KEY')

my_bolt = Bolt(api_key, device_id)

# Turn on the LED

response = my_bolt.digitalWrite('0', 'HIGH')

print(my_bolt.digitalRead('0'))

Previously this code used to work fine but not very unusual things I got to see when I ran this code.
Whenever I am running this python script. My LED goes on for a second and turns off on its own. WHY???
And output I am getting is {“value”: “0”, “success”: 1} instead of {“value”: “1”, “success”: 1}.
When I turn on the LED using .html code it is working fine.

I am about to finish my submission project, and now this behavior of bolt all of a sudden is making me anxious.

I am wondering if it is something to do my current circuit.
If yes, then do let me know.
P.S. If I remove the negative end of LED from the GND pin. The python script is working fine. Output → {“value”: “1”, “success”: 1}.

Hi @tahseen,

Double-check if the LED is connected to the correct GPIO pin. The ‘0’ in my_bolt.digitalWrite(‘0’, ‘HIGH’) and my_bolt.digitalRead(‘0’) represents the GPIO pin number. Make sure you are using the correct pin number for the LED.
I am not able to view your LED connection properly since you are also using a Buzzer as well.
Send a proper photograph of the circuit so that I can check and get back to you.

Double-check if the LED is connected to the correct GPIO pin; checked
Make sure you are using the correct pin number for the LED.: script also use the same GPIO pin number for LED.

It is in fact turning on the LED but only for a second if I am using python script.
and if I remove the -ve pin of LED from the GND, then also I am getting the expected output → {“value”: “1”, “success”: 1} else getting this output → {“value”: “0”, “success”: 1}

And when I am using html code to do the same, for the SAME CIRCUIT it is working completely fine.
Can you please consider zooming in on the image as I am able to do so and then every connection is clearly visible.

@tahseen

The circuit connections seems fine.

Can you please try
response = my_bolt.digitalWrite(‘0’, ‘HIGH’)
print(“Digital write response:”, response)

time.sleep(5)

response = my_bolt.digitalRead(‘0’)
print(“Digital read response:”, response)

And tell me what output you are getting so that we can see at what stage the circuit is not working as expected.

Instead of blinking this time LED glow for the specified seconds and then goes off of its own.

@tahseen

It is because of this time.sleep(5) line.
Can you please let me know what is printed as the output?

Output → value: 0, success:1

Have you identified where the issue is?

Hi @tahseen,

Apologies for the delay in getting back to you
We are looking into this and will reply to you at the earliest.

1 Like