Zynq design from scratch. Part 36.
Building a web enabled application
Web serving embedded applications become a lot more useful when the web interface can be used to control the device, or monitor sensor inputs. In this step, we will build and experiment with a simple web-enabled application controlling the LEDs on the ZedBoard.
Create an application
We will create a CGI script called LEDcontrol by running the petalinux-create command from inside a PetaLinux project on our workstation.
->petalinux-create -t apps --name LEDcontrol
Download the program code
The program code can be downloaded from here. I would like to thank John Williams (the father of PetaLinux) at Xilinx for providing me with the source code.
Copy the code to the application directory
Unzip, unpack and copy the downloaded files to the LEDcontrol directory. Here is the result.
Build and install the application program
For more information see part 29 and part 35.
->petalinux-build -c rootfs/LEDcontrol -x build
Controlling hardware from the web browser
We can now control the LEDs on the ZedBoard from our web browser.
- Make sure the web server is running in PetaLinux: ->httpd -p 8080 -h /home/httpd
- Open a web browser on the host
- Enter the webaddress: <IP address of the board>:8080/cgi-bin/LEDcontrol
- ZedBoard LED Control window will open
- Enter the LED GPIO ID. In our case it is 243
- Click the ON/OFF links to turn on/off the LEDs on the ZedBoard
This is just one small example. We could include much more control from our web application. It is up to your imagination.
Top Previous Next