Project showcase
Web-Based Servo Control with PHPoC Shield for Arduino

Web-Based Servo Control with PHPoC Shield for Arduino © GPL3+

Control servo by web.

  • 3,854 views
  • 1 comment
  • 24 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
Phpoc shield for arduino per pztifwjlwk
PHPoC Shield for Arduino
Shield for network connectivity for Arduino
×1

About this project

Code

Web-based Servo Control with PHPoC Shield for ArduinoC/C++
Web-based Servo Control with PHPoC Shield for Arduino
#include "SPI.h"
#include "Phpoc.h"
#include "Servo.h"

PhpocServer server(80);
Servo myservo;
char slideName;
int slideValue;

void setup() {

  myservo.attach(9);
  
  Serial.begin(115200);
  while(!Serial)
    ;

  Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
  server.beginWebSocket("remote_slide");

  Serial.print("WebSocket server address : ");
  Serial.println(Phpoc.localIP());  
}

void loop() {
  PhpocClient client = server.available();
  
  if (client) {
    String slideStr = client.readLine();
    
    if(slideStr) {
      slideName = slideStr.charAt(0);
      slideValue = slideStr.substring(1).toInt();
      
      if(slideName == 'A'){
        int pos = map(slideValue, -100, 100, 0, 180);
        myservo.write(pos);
        Serial.println(pos);
      }
    }
  }
}

Comments

Similar projects you might like

Servo Control with TV Remote Control

Project showcase by eldo85

  • 5,592 views
  • 5 comments
  • 17 respects

PHPoC - Arduino Self Balancing Robot with BT+Web Control

Project in progress by Suyog Gunjal

  • 3,675 views
  • 2 comments
  • 23 respects

Using Serial Monitor to Control Servo Motor

Project tutorial by Kub_Luk

  • 4,988 views
  • 10 comments
  • 33 respects

Control an LED with the Remote Control

Project showcase by Nicholas_N

  • 3,197 views
  • 2 comments
  • 9 respects

Arduino Dynamic Web Control

Project tutorial by phpoc_man

  • 34,757 views
  • 15 comments
  • 117 respects
Add projectSign up / Login