Bolt as input as well as an output device

Hi All
My project has an analog input and a digital output.How to use both input and output at once in my project as we need to decide if Bolt will be an input or output device.Pls help!!

Hello, it is not possible for a digital pin i.e GPIO to be input and output simultaneously, instead what you can do is to divide your code into segments and then tell your BOLT device to change configurations of that pin accordingly.
eg: let’s assume 1st you have to accept the input then use digital read, then store that result into something(if you need it off course)
then in the 2nd part use digital write and set the output to that pin according to your need.

Here I gave you an example for digital pins, you can apply the same for analogue pins too!!

I hope this solves your doubt!!

thanks for helping,but what should i select first while making a product input or output device?
I’m using analog pin as an input and digital pin as an output.

See this entirely depends on you!! If you want to make the product as an input device then you will write configurations to accept the data first and vice versa.

If your output depends on input then you will write configurations of input and then that of output accordingly.

Also I would suggest you to write the code in python for your application because if you are writing the code through bolt cloud in form of a product then it only allows you to make your pin as either input or output, whereas in python you can change configuration of the same pin as many times as you want.

I hope this solves your doubt!!

1 Like