Project showcase
Adjust Brightness of an LED

Adjust Brightness of an LED © GPL3+

Adjust brightness of an LED with the PHPoC shield for Arduino.

  • 4,051 views
  • 0 comments
  • 18 respects

Components and supplies

About this project

Subject

Adjust brightness of an LED with the PHPoC shield for Arduino.

Hardware Components

  • Arduino Uno
  • PHPoC Shield for Arduino
  • 220 ohm resistor/LED

Software Library

  • PHPoC library (WebRemoteSlide)

Code

CodeC/C++
Source Code
#include "SPI.h"
#include "Phpoc.h"

// Arduino web server 
PhpocServer server(80);

char slideName;
int slideValue;

void setup() {
  Serial.begin(9600);
  while(!Serial)
    ;

  Phpoc.begin(PF_LOG_SPI | PF_LOG_NET);
  //Phpoc.begin();

  server.beginWebSocket("remote_slide");

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

  analogWrite(9, 100);
}

void loop() {
  // wait for a new client:
  PhpocClient client = server.available();

  if (client) {
    String slideStr = client.readLine();

    if(slideStr)
    {
      slideName = slideStr.charAt(0);
      slideValue = slideStr.substring(1).toInt();

      if(slideName == 'B')
      {
        analogWrite(9, slideValue + 100);
      }

      Serial.print(slideName);
      Serial.print('/');
      Serial.println(slideValue);
    }
  }
}

Schematics

Connection Diagram
Led sketch wvfsxs7bxj

Comments

Similar projects you might like

Bluetooth control led with lcd led status display real time.

Project tutorial by Youssef Sabaa

  • 17,292 views
  • 4 comments
  • 34 respects

LED Emergency Lights using WS2812 RGB LED Module

Project tutorial by bigboystoys13

  • 10,004 views
  • 5 comments
  • 20 respects

Controlling LED Brightness Using Bolt and Arduino

Project tutorial by Devashish Gupta

  • 1,638 views
  • 4 comments
  • 13 respects

LED Blink Pattern

Project tutorial by Matt Arnold

  • 30,329 views
  • 14 comments
  • 84 respects

LED Dice

Project showcase by EvdS

  • 14,276 views
  • 11 comments
  • 49 respects

Turn On and Off LED by LDR (Toggle LDR)

Project showcase by muhammed amar slik

  • 19,773 views
  • 1 comment
  • 13 respects
Add projectSign up / Login