How to run a servo motor on a arduino connected to boltIot (diy pet feeder project)?

The Html code for the DIY pet feeder seems to not be working. The Arduino code worked fine till void loop. I am trying to make a robot-controlled using HTML/Js(Later with google assistant) and I’m using the Arduino for control command with switch. I searched for alternatives of this project to find the solution but could find none.

Hi @varunjkp2001,

Apology for the delay in response. I am inviting @shoeb.ahmed. He will help you out by tomorrow EOD.

@varunjkp2001 It would be better to describe the problem that you are facing. Any code or screenshots of the error would be helpful.

i used the same html code as given in hackster.io/github

<!DOCTYPE html>
<html>
<head>
   <title>Pet Feeder</title>
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
   <style>
       .button {
           background-color: #4CAF50;
           border: none;
           color: white;
           padding: 15px 32px;
           text-align: center;
           text-decoration: none;
           display: inline-block;
           font-size: 16px;
           margin: 4px 2px;
           cursor: pointer;
       }
   </style>
</head>
<body>
   <br>
   <button class="button" onclick="dispense_treat()">Feed me!</button>
<script type="text/javascript">
   function dispense_treat(){
       console.log("Dispensing Treat");
       start_communication();
       open_door();
       setTimeout(2000,close_door());
       console.log("Dispensed Treat");
   }
   function start_communication(){
       cmd_serial_begin();
       console.log("Init Communication");
   }
   function open_door(){
       cmd_serial_write("a");
       console.log("Opened Door");
   }
   function close_door(){
       cmd_serial_write("b");
       console.log("Closed Door");
   }
   function cmd_serial_write(data_val){
       $.get("https://cloud.boltiot.com/remote/"+"Your API Key Here"+"/serialWrite?data="+data_val+"&deviceName="+"Your Bolt ID here");
   }
   function cmd_serial_begin(){
       $.get("https://cloud.boltiot.com/remote/"+"Your API Key Here"+"/serialBegin?baud=9600&deviceName="+"Your Bolt ID here");
   }
</script>
</body>
</html>

After entering my bolt device and api key
I also uploaded the boltduino code into the arduino and made the following connections.

#include<Servo.h>
Servo servo;
const int LED_PIN =  LED_BUILTIN; // The number of the LED pin
int SERVO_PIN = 9;    // The pin which the servo is attached to
int CLOSE_ANGLE = 0;  // The closing angle of the servo motor arm
int OPEN_ANGLE = 60;  // The opening angle of the servo motor arm
void setup() {
 // put your setup code here, to run once:
 Serial.begin(9600);
 pinMode(LED_PIN,OUTPUT);
 servo.attach(SERVO_PIN);
 servo.write(CLOSE_ANGLE); // Close the trapdoor when it first boots up
}
void loop() {
 // put your main code here, to run repeatedly:
 if(Serial.available()){
   char c = Serial.read();   // Read data sent by the cloud
   switch(c){
     case 'a' : digitalWrite(LED_PIN,HIGH);  // If character received is 'a', dispense the treat
                open_door();
                delay(1000);
                close_door();
                digitalWrite(LED_PIN,LOW);
                break;
     case 'b' : digitalWrite(LED_PIN,LOW);   // If charecter received is 'b', close the trapdoor
                close_door();
                break;
     case 'c' : digitalWrite(LED_PIN,HIGH);  // If charecter received is 'c', open the trapdoor
                open_door();
                break;  
     default : digitalWrite(LED_PIN,LOW);
               break;
   }
 }  
}
void open_door(){
 Serial.println("Opened Door");
 servo.write(OPEN_ANGLE);   // Send the command to the servo motor to open the trap door
}
void close_door(){
 Serial.println("Closed Door");
 servo.write(CLOSE_ANGLE);   // Send te command to the servo motor to close the trap door
} 

when i run the html page and click on the button feed me! ,nothing happens the servo motor dosn’t rotate.
image

please reply asap @shoeb.ahmed

It has been 3 months and there is no reply. Still trying to know if bolt-Arduino interface works ?