W5100 - CONTROLLING AN RGB LED VIA PWM WITH HTML
W5100 - CONTROLLING AN RGB LED VIA PWM WITH HTML
0
Components
Hardware componentsSoftware Apps and online services
Project description
- Shield Ethernet W5100 ? Creating a Web Server with Arduino
- Shield Ethernet W5100 ? Monitoring Sensors with a Web Server
- Shield Ethernet W5100 ? Controlling Outputs via Web Server
- Shield Ethernet W5100 ? Remote Triggering of Relays with HTML
Index?[?View?]
Let's go - Creating the HTML interface for handling the RGB LED via PWM
Required components
To develop this project, we will need the following components:- 1 x Arduino Board UNO Rev 3
- 1 x Shield Ethernet Wiznet W5100
- 1 x Common Cathode RGB LED
- 3 x 330Ω resistors
- 1 x Protoboard
assembling the project

programming
putting it to work

understanding in depth
software
Before we start with the explanation of the code, we would like to emphasize that we will only present the details of the topics not covered in the previous tutorials, as this way it will be easier to focus on the parts referring to the updates made to the already existing program, therefore, if If you have any questions about any part of the program that is not explained at this time, we suggest that you access our aforementioned materials.? Defining the prerequisites for the code to work
Initially, we must include two libraries in the code so that it could work correctly.?The?SPI.h?library??,??responsible for the communication of the shield modules with the??Arduino UNO??using the?SPI??protocol??and the?Ethernet.h??library??,??which acts by enabling the connection of the set, at first, with a local network. After including the mentioned libraries, we must define a??MAC address??(remember that this can be anything, as long as it is unique in your local network) and an??IP address??(this must be a valid and available address within your local network ).?In addition, we must create the object that will be responsible for representing the??Web Server??in the code (here, we call this??server?) and relate it to port 80.? Defining initial settings
Within the?setup()?function?, we must determine the operating mode of the digital pins that will be used (these will play the role of digital outputs) .?In addition, we start the connection with the local network through the?Ethernet.begin()??function??(passing as parameter the??MAC??and??IP addresses??defined previously) and we also start the??Web Server??through the sentence??server.begin()??(remember that??server??is the object created to represent the??Web Server??in code).? Understanding browser requests
In previous tutorials, we highlighted the basic operating mechanism of codes aimed at creating Web Servers, which starts through a standard procedure, which in turn, consists of using a variable to obtain character by character of the request made by the browser until this is completely received by??Arduino UNO?, so that only from this point does the process of creating the page begin. In our last tutorial, we presented how the GET method works, however, in this material we will make use of the POST method.?Like the GET method, the POST method also serves to send information from forms to our Web Server. The first step to carry out this procedure in the declaration of a local variable, of type String (this will serve to store the request made by the browser).? Submitting the page header
After we have read the entire request, we must first send the default header to the browser.? Developing our page
To start developing our page, we first use the sentence?<!DOCTYPE html>?to inform the browser that we are using version 5 of the HTML language.? Creating the form
At this point, we added the form and explained that the method that will be used to send data in the request made by the browser will be POST.?Between the?<form>?and?</form>?tags?, we will create the ranges, that is, the elements that will be used in the command interface on the browser page.- type: Determines the type of input element
- value: Value where the cursor should stay
- name: Name associated with the element
- min/max: Extreme values ??of the scale
- step: step


