Website development

Going further, this project is about hosting your personal or any kind of website on Raspberry Pi Zero W. In this section, we will not have an analytic discussion on how you can develop your website. However, I will mention different ways that you can work and give a general direction on what you should and should not do. Some websites have a total size in MBs and others may go up to GBs depending on the size of files that are necessary. Thus, choosing wisely when selecting the type of website that you will host is quite important and if you skip this, you may encounter problems, errors, and many more issues.

The development of a website depends one hundred percent on your need. You can create a simple website with buttons for your IoT project so that you can have access to your other Arduino or Raspberry Pi devices; or you can create a temporary simple responsive website using HTML, CSS, and JavaScript; or you can even set up a database and create an e-shop. Obviously, this section will not tell you how to create an advanced website, but it will guide you through some basic steps on how you can develop the simplest one. Let's say that the scenario here is to develop a website on which you click on a button and open a door. The website should have a button and a text that indicates the button's activity. On your local machine, open up your favorite editor and create a simple HTML file, where you have inserted a button. The code is as follows:

<!DOCTYPE html> 
<html> 
<body> 
This button activate something:<button type="button" onclick="alert('Hello world!')">Active</button>  
</body> 
</html> 

First, we define the DOCTYPE as HTML. Next, inside the body tag, we need to create a button that when clicked on, says Hello world. Obviously, you have to change this and link it with the Arduino project that you might have. The preceding website looks similar to the following image:

After clicking on the Active button, you will see a pop-up window as follows:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.80.45