Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
193b13b
adjust pages and font size
Aug 11, 2017
fc6700f
add gpio check script
Aug 11, 2017
e7ee75a
add power button
Aug 11, 2017
63cf515
add screenshots
Jailman Aug 11, 2017
b68390a
add robot driver
Aug 14, 2017
7ea9473
robot driver import put inside function
Aug 14, 2017
fef4431
add button binding to keyboard
Aug 14, 2017
df75e93
add servo keybind
Aug 14, 2017
377d70e
add logout button and flash messages
Aug 14, 2017
95969cb
fix some bugs
Aug 14, 2017
6237f49
add countdown to error pages
Aug 14, 2017
c1f80e8
ädd task file
Aug 14, 2017
2b1a93e
add tasks
Aug 14, 2017
20583f9
adjust session time
Aug 14, 2017
1280f25
add global login support in raspberrypi.py
Aug 15, 2017
a408796
fix a small bug in raspberrypi.py
Aug 15, 2017
60661a8
fix keybinding bug
Aug 15, 2017
58eb067
change task
Aug 15, 2017
6b398bb
limit user to only admin1
Aug 15, 2017
473d559
add command button
Aug 15, 2017
d862896
optimized command page and made some flash message change in login page
Aug 15, 2017
0e727a6
add a shit file requirements.txt
Aug 15, 2017
521854b
rip off some irrelevant modules in requirements.txt
Aug 15, 2017
d042277
update requirements.txt
Aug 15, 2017
a1a302d
add tasks and adjust directory tree
Aug 16, 2017
48c9a11
license moved to parent folder and readme.md changed
Aug 16, 2017
3cf30be
upate readme.md
Aug 16, 2017
1f6de63
add material folder and moved help files in
Aug 16, 2017
1b03f0f
add raspberrypi2b materials
Aug 16, 2017
e8d0cfb
add slider to amaze_me page
Aug 16, 2017
810aee3
add pca9685 servo drive board material
Aug 16, 2017
8bb06b6
add another pca9685 material
Aug 16, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Materials/Arduino/uno.pdf
Binary file not shown.
Binary file not shown.
Binary file added Materials/L298N/L298中文资料.pdf
Binary file not shown.
Binary file not shown.
Binary file added Materials/PCA9685/PCA9685servo.pdf
Binary file not shown.
Binary file not shown.
Binary file added Materials/RaspberiPi-2B/raspberrypi_top.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 38 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,38 @@
# raspberrypirobot
Date: 2017.8.11<br>
A RaspberryPi robot website supported by flask<br>
It has multi functions, feel free to explore.<br>
A repository for raspberrypi robot source codes<br>
Still under developing<br>
Visit <a href="http://www.karachiwarship.top">KarachiWarship</a> for more details.
# RaspberryPi Robot #
## Date: 2017.8.16<br> ##
###
A RaspberryPi robot web terminal programmed with flask and some tools that helps to set up a complete robot.<br>
It has multiple functions, can act as the homeautomation center.<br>
It is still under developing<br>
###

### login ###
<img src=http://chuantu.biz/t5/168/1502445429x2093065985.png />

### index ###
<img src=http://chuantu.biz/t5/168/1502445406x2093065985.png />

### patrol ###
<img src=http://chuantu.biz/t5/168/1502445447x2093065985.png />

### sensor graph ###
<img src=http://chuantu.biz/t5/168/1502445470x2093065985.png />

### home automation ###
<img src=http://chuantu.biz/t5/168/1502445378x2093065985.png />

### 404 ###
<img src=http://chuantu.biz/t5/168/1502445259x2093065985.png />

### 403 ###
<img src=http://chuantu.biz/t5/168/1502445354x2093065985.png />

Visit [KarachiWarship](http://www.karachiwarship.top) for more details.


# Tools #
* [Fritzing](http://fritzing.org)
* [xmind](http://www.xmind.net/)
* [Arduino IDE](http://arduino.cc/en/Main/Software)
* [Pycharm]()
* [VSCode]()
File renamed without changes.
Binary file added Web-Terminal/Modules/__init__.pyc
Binary file not shown.
File renamed without changes.
Binary file added Web-Terminal/Modules/driver.pyc
Binary file not shown.
22 changes: 22 additions & 0 deletions Web-Terminal/Modules/gpiostat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

"""
Judge gpio status
"""

import RPi.GPIO as GPIO
import time

def gpio_status(GPIO_PIN):
GPIO.setmode(GPIO.BCM)
GPIO.setup(GPIO_PIN, GPIO.IN)
if(GPIO.input(GPIO_PIN) == 1):
return "on"
else:
return "off"
GPIO.cleanup()

if __name__ == '__main__':
GPIO_PIN = 12
print gpio_status(GPIO_PIN)
Binary file added Web-Terminal/Modules/gpiostat.pyc
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions Web-Terminal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# raspberrypirobot
Date: 2017.8.11<br>
A RaspberryPi robot website supported by flask<br>
It has multi functions, feel free to explore.<br>
A repository for raspberrypi robot source codes<br>
Still under developing<br>

<h3>login</h3>
<img src=http://chuantu.biz/t5/168/1502445429x2093065985.png />

<h3>index</h3>
<img src=http://chuantu.biz/t5/168/1502445406x2093065985.png />

<h3>patrol</h3>
<img src=http://chuantu.biz/t5/168/1502445447x2093065985.png />

<h3>sensor graph</h3>
<img src=http://chuantu.biz/t5/168/1502445470x2093065985.png />

<h3>homeauto</h3>
<img src=http://chuantu.biz/t5/168/1502445378x2093065985.png />

<h3>404</h3>
<img src=http://chuantu.biz/t5/168/1502445259x2093065985.png />

<h3>403</h3>
<img src=http://chuantu.biz/t5/168/1502445354x2093065985.png />

Visit <a href="http://www.karachiwarship.top">KarachiWarship</a> for more details.
14 changes: 14 additions & 0 deletions Web-Terminal/TASK
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#添加全局登录(finished)
#添加amaze me slide图片展示
#添加cmd页面链接(finished)
#优化cmd命令结果展示(finished)
#添加cmd命令路由(finished)
#添加数据库温湿度数据录入和展示
#添加管理后台,增加用户管理
#用户邮件和自动化操作通知
#人体感应通知
#RESTful API
#电量检测*
#红外遥控操作*(空调,夜灯)
#无线遥控操作*(插座开关)
#蓝牙遥控操作*(电视)
63 changes: 47 additions & 16 deletions raspberry.py → Web-Terminal/raspberry.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
PASSWORD='111'
))
app.config.from_envvar('FLASKR_SETTINGS', silent=True)
app.permanent_session_lifetime = timedelta(hours=24)
app.permanent_session_lifetime = timedelta(hours=5)



Expand All @@ -48,15 +48,15 @@ def page_not_found(error):
title = 'Error 404'
return render_template('404.html', title=title), 404

@app.errorhandler(503)
@app.errorhandler(500)
def server_error(error):
title = 'Error 503'
return render_template('503.html', title=title), 503
return render_template('503.html', title=title), 500


#command page
@app.route('/command')
def show_entries():
def command():
title = 'Command'
if not session.get('logged_in'):
abort(403)
Expand All @@ -83,19 +83,19 @@ def login():


#logout page
# @app.route('/logout')
# def logout():
# session.pop('logged_in', None)
# flash('You were logged out, fucker?')
# return redirect(url_for('login'))
@app.route('/logout')
def logout():
session.pop('logged_in', None)
flash('Warning: You were logged out!')
return redirect(url_for('login'))



'''##########Pi Pages##########'''
#raspberrypi pages
@app.route('/index')
def index():
session.permanent = True
# session.permanent = True
if not session.get('logged_in'):
abort(403)
return render_template('index.html')
Expand Down Expand Up @@ -137,19 +137,50 @@ def get_humidity():
def get_time():
return "['2:00', '2:05', '2:10', '2:15', '2:20', '2:25', '2:30', '2:35', '2:40', '2:45', '2:50', '2:55']"


'''##########CGI drivers##########'''
'''##########Pi Power Control##########'''
# from Modules.gpiostat import gpio_status

@app.route('/power')
def query():
# querystatus
return "on"
# GPIO_PIN = 12
# return gpio_status(GPIO_PIN)

@app.route('/power/<control>')
def switch(control):
if control == "on":
# switchon
return "on"
if control == "off":
# switchoff
return "off"


'''##########Robot drivers##########'''

@app.route('/driver/<control>')
def robot_driver(control):
from Modules import driver as d
d.init_driver()
if control == "forward":
d.forward()
if control == "backward":
d.backward()
if control == "stop":
d.stop()
if control == "left":
d.left()
if control == "right":
d.right()

'''##########Servo drivers##########'''
# @app.route('/servo/<float:post_value>')
# def servo_ctrl(post_value):
# servo.somefunc(post_value)


'''##########Wheel drivers##########'''
# @app.route('/wheel/<direction>')
# def wheel_ctrl(direction):
# driver.somefunc(direction)




Expand Down
Loading