In this tutorial, we are going to use Python to setup pcDuino as a we b server:
1. Install Requests (Requests is a HTTP client library of Python)
- $ sudo apt–get install python–requests
2. Install python-pip (python-pip is a tool used to install and manage python software package)
- $sudo apt–get install python–imaging python–imaging–tk python–pip python–dev git
Note: If the above command failed, please run the following command first:
- $sudo pip install flask
3. Install Flask (Flask is a light weight web application framework written in Python):
- $sudo pip install flask
4. Sample code:
- from flask import Flask
- app = Flask(__name__)
- @app.route(“/”)
- def hello():
- return ” Welcome to pcDuino ! “
- if __name__ == “__main__”:
- app.run(host=‘0.0.0.0’, port=80, debug=True)
Save the above code to a file named hello-flash.py, and run “sudo python ./helleo-flash.py”:
5. Use ‘ifconfig’ command to find out the IP address of pcDuino:
6. On another PC or iPad that shares the same router, open a web browser, and input 192.168.1.35:
You can see that it works! At the same time, on pcDuino’s terminal, the following message will display:
Leave a Reply
You must be logged in to post a comment.