You can have as many buttons in the code as you want.
The above code allows you control over pin 0, to control the other pin, just change the number β0β inside the digitalWrite function to the pin number that you want to control.
Yup thanks for correcting me there. It took some time to crunch it out but now I understand.
So bolt cannot take any actions on its own, all the logic have to be implemented on the cloud. Say for example if I have to glow an LED when a push button is pressed. I have to check the input pin status using an API and then based on the result form API I have to use another API to toggle the status of the output pin right?
I am not much comfortable with javascript and HTML so I went with python and used the below code to blink an LED. (API key and ID have been edited)
import requests
import time
while True:
r = requests.get('https://cloud.boltiot.com/remote/4749fe75-6c61-45f1-bee5-f9a6a1bd7103/digitalWrite?pin=0&state=HIGH&deviceName=BOLT11671968')
time.sleep(1)
r = requests.get('https://cloud.boltiot.com/remote/4749fe75-6c61-45f1-bee5-f9a6a1bd7103/digitalWrite?pin=0&state=LOW&deviceName=BOLT11671968')
time.sleep(1)
r.text
The program worked, but while I was enjoying my small victory I reached my API call limits of 200 and ended up being suspended for 6 hours.
bolt cannot take any actions on its own, all the logic have to be implemented on the cloud.
If the above stated statement is true then it can be considered as a drawback since I cannot interface much hardware on my bolt. So the GPIO, analog and PWM functions cannot be used much.
Also another drawback I could think of is, how would one implement sleep mode? It would great if we have one to use BOLT on coin cell or other battery powered applications. Sorry for deviating way out of the question just thought of sharing the info,
Anyway other than this I really enjoyed getting started with bolt and looking forward to built something cool.
Sir,I want to create current monitoring system.
I have connected the circuit as shown below.
It is displaying 1024 instead of 0.1Ampere.
Code:I have written the code as shown in Second figure below: