I was trying to control a pin on arduino board using bolt wifi module by the serial write function. I was using the bolt api service to send the serial write function. But it isn’t working. I am not able to find the mistake.
#include <boltiot.h>
#ifndef API_KEY
#define API_KEY "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
#endif
#ifndef DEVICE_ID
#define DEVICE_ID "BOLTxxxxxxxx"
#endif
const int LED = 13;
String LEDon(String *data) {
digitalWrite(LED, HIGH);
return "PIN 13 was turned on...";
}
String LEDoff(String *data) {
digitalWrite(LED, LOW);
return "PIN 13 was turned OFF";
}
void setup() {
// put your setup code here, to run once:
pinMode(LED, OUTPUT);
digitalWrite(LED, LOW);
boltiot.begin(Serial);
boltiot.setCommandString("ON", LEDon);
boltiot.setCommandString("OFF", LEDoff);
Serial.println("Bolt IOT - Arduino Ready!");
}
void loop() {
// put your main code here, to run repeatedly:
boltiot.handleCommand();
}
Thanks in advance for the help 
Sorry but this isn’t helping. You used BoltIoT Arduino Helper Library in the include tag but now it is changed to boltiot.h library. Can you please check my code and let me know if anything can be done?
Hi @mightyakash124 ,
I agree that boltiot Arduino helper library is renamed to boltiot.h
Kindly change the header file to boltiot.h
Remaining code will be same.
One more thing came to my mind…could it be that any one of the RX/TX ports are not working?
For more information, I tried reading serial data from the arduino in the bolt and it worked fine but serial write is not working…
Can this might be any problem of the Serial ports?
@skumawatrenwal11 The link that you gave, I copy pasted the code but still it isn’t working. I tried writing the serial data through the Arduino Serial Monitor in my PC and it worked fine but when I tried to use the api to write it through Bolt Module, it isn’t working.
Edit: I recorded a video of this, if you want to take a look please give me your email so that I can share it to you.
I found the solution… It was a mistake with the connection of the bolt wifi module and the arduino. I didn’t connect the 5V and GND pins of arduino and bolt wifi previously. After connecting those it is now working fine…
1 Like