├── server ├── README.MD ├── pi_car │ ├── config.pyc │ ├── views.pyc │ ├── __init__.pyc │ ├── static │ │ ├── img │ │ │ ├── up.png │ │ │ ├── down.png │ │ │ ├── left.png │ │ │ ├── right.png │ │ │ ├── stop.png │ │ │ └── stop - 副本.png │ │ ├── car.js │ │ ├── car.common.js │ │ ├── style.css │ │ └── jquery-1.11.2.min.js │ ├── config.py │ ├── templates │ │ ├── home.html │ │ └── layout.html │ ├── __init__.py │ └── views.py └── server.py ├── client ├── csharp │ ├── PiCar │ │ ├── icon.ico │ │ ├── App.config │ │ ├── Properties │ │ │ ├── Settings.settings │ │ │ ├── Settings.Designer.cs │ │ │ ├── AssemblyInfo.cs │ │ │ ├── Resources.Designer.cs │ │ │ └── Resources.resx │ │ ├── Program.cs │ │ ├── WangHeng.Org.PiCar.csproj │ │ ├── HttpUtility.cs │ │ ├── MainFrm.Designer.cs │ │ └── MainFrm.cs │ └── WangHeng.Org.PiCar.sln └── android │ ├── ic_launcher-web.png │ ├── libs │ └── android-support-v4.jar │ ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── values-sw600dp │ │ └── dimens.xml │ ├── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── menu │ │ └── main.xml │ ├── values-sw720dp-land │ │ └── dimens.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── layout │ │ └── activity_main.xml │ ├── src │ └── com │ │ └── apiof │ │ └── picar │ │ ├── WebUtils.java │ │ ├── HttpUtils.java │ │ └── MainActivity.java │ ├── .settings │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs │ ├── gen │ └── com │ │ └── apiof │ │ └── picar │ │ ├── BuildConfig.java │ │ └── R.java │ ├── .classpath │ ├── project.properties │ ├── proguard-project.txt │ ├── .project │ └── AndroidManifest.xml └── README.md /server/README.MD: -------------------------------------------------------------------------------- 1 | 服务端,使用python 编写。默认端口为 2000 2 | -------------------------------------------------------------------------------- /server/pi_car/config.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/server/pi_car/config.pyc -------------------------------------------------------------------------------- /server/pi_car/views.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/server/pi_car/views.pyc -------------------------------------------------------------------------------- /server/pi_car/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/server/pi_car/__init__.pyc -------------------------------------------------------------------------------- /client/csharp/PiCar/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/client/csharp/PiCar/icon.ico -------------------------------------------------------------------------------- /server/pi_car/static/img/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/server/pi_car/static/img/up.png -------------------------------------------------------------------------------- /client/android/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/client/android/ic_launcher-web.png -------------------------------------------------------------------------------- /server/pi_car/static/img/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/server/pi_car/static/img/down.png -------------------------------------------------------------------------------- /server/pi_car/static/img/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/server/pi_car/static/img/left.png -------------------------------------------------------------------------------- /server/pi_car/static/img/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/server/pi_car/static/img/right.png -------------------------------------------------------------------------------- /server/pi_car/static/img/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/server/pi_car/static/img/stop.png -------------------------------------------------------------------------------- /server/pi_car/static/img/stop - 副本.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/server/pi_car/static/img/stop - 副本.png -------------------------------------------------------------------------------- /client/android/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/client/android/libs/android-support-v4.jar -------------------------------------------------------------------------------- /client/android/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/client/android/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /client/android/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/client/android/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /client/android/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/client/android/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /client/android/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/client/android/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /client/android/src/com/apiof/picar/WebUtils.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RDFS/piCar/master/client/android/src/com/apiof/picar/WebUtils.java -------------------------------------------------------------------------------- /client/android/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/com/apiof/picar/MainActivity.java=UTF-8 3 | -------------------------------------------------------------------------------- /client/csharp/PiCar/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /client/android/gen/com/apiof/picar/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.apiof.picar; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /client/android/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /client/android/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /client/android/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # My Pi Car 2 | =============================== 3 | Author: WangHeng 4 | 5 | Blog: http://wangheng.org 6 | #### LISENSE:GPL 7 | =============================== 8 | User Guide: 9 | 10 | 11 | > sudo python server.py 12 | 13 | 14 | then visit Pi_IP:2000 15 | -------------------------------------------------------------------------------- /client/csharp/PiCar/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /client/android/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /server/pi_car/static/car.js: -------------------------------------------------------------------------------- 1 | WH.Init=function(){ 2 | $(".button_ctl").each(function(){ 3 | $(this).click(function(){ 4 | data={ 5 | id : $(this)[0].id 6 | }; 7 | console.log(data); 8 | 9 | WH.Common.ajaxRequest("/ctl",data,function(){ 10 | console.log("success"); 11 | }); 12 | }); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /client/android/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /client/android/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /client/android/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /client/android/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /server/server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | ''' 3 | #============================================================================= 4 | # FileName: server.py 5 | # Desc: 6 | # Author: wangheng 7 | # Email: wujiwh@gmail.com 8 | # HomePage: http://wangheng.org 9 | # Version: 0.0.1 10 | # LastChange: 2015-01-13 20:58:54 11 | # History: 12 | #============================================================================= 13 | ''' 14 | from pi_car import app 15 | 16 | app.run(host='0.0.0.0',port=2000) 17 | -------------------------------------------------------------------------------- /client/csharp/PiCar/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | 6 | namespace WangHeng.Org.PiCar 7 | { 8 | static class Program 9 | { 10 | /// 11 | /// 应用程序的主入口点。 12 | /// 13 | [STAThread] 14 | static void Main() 15 | { 16 | Application.EnableVisualStyles(); 17 | Application.SetCompatibleTextRenderingDefault(false); 18 | Application.Run(new MainFrm()); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /client/android/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | piCar 5 | Settings 6 | Hello world! 7 | 小车控制 by http://wangheng.org 8 | 后退 9 | 左转 10 | 停止 11 | 前进 12 | 右转 13 | Infomation 14 | 15 | 16 | -------------------------------------------------------------------------------- /client/android/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-19 15 | -------------------------------------------------------------------------------- /server/pi_car/static/car.common.js: -------------------------------------------------------------------------------- 1 | var WH; 2 | if (!!WH && (typeof WH != 'object' || WH.name)) throw new Error("namespace already exists!"); 3 | WH = {}; 4 | 5 | WH.name = 'wangheng\'s car control project!'; 6 | WH.author="wangheng"; 7 | WH.version="0.1"; 8 | (function($) { 9 | 10 | WH.Common = { 11 | ajaxRequest : _ajaxRequest 12 | }; 13 | 14 | function _ajaxRequest(actionUrl, postData, successHandler, 15 | errorHandler) { 16 | setTimeout(function() { 17 | $.ajax({ 18 | cache : false, 19 | async : true, 20 | type : "post", 21 | url : actionUrl, 22 | data : postData, 23 | dataType : "json", 24 | success : successHandler, 25 | error : errorHandler 26 | }); 27 | }, 0); 28 | } 29 | 30 | })(jQuery); 31 | -------------------------------------------------------------------------------- /client/android/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /server/pi_car/config.py: -------------------------------------------------------------------------------- 1 | ''' 2 | #============================================================================= 3 | # FileName: config.py 4 | # Desc: 5 | # Author: wangheng 6 | # Email: wujiwh@gmail.com 7 | # HomePage: http://wangheng.org 8 | # Version: 0.0.1 9 | # LastChange: 2015-01-14 13:49:32 10 | # History: 11 | #============================================================================= 12 | ''' 13 | import os 14 | class Config(object): 15 | BASEDIR = os.path.abspath(os.path.dirname(__file__)) 16 | DATABASE = BASEDIR+'/var/pi.db' 17 | SECRET_KEY = os.urandom(24) 18 | USERNAME = 'admin' 19 | PASSWORD = 'default' 20 | DEBUG = True 21 | HOST = '0.0.0.0' 22 | PORT = 2000 23 | class Development(Config): 24 | pass 25 | class Production(Config): 26 | DEBUG = False 27 | HOST = '0.0.0.0' 28 | PORT = 8080 29 | -------------------------------------------------------------------------------- /server/pi_car/templates/home.html: -------------------------------------------------------------------------------- 1 | {% extends "layout.html" %} 2 | {% block body %} 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 |
23 | 24 | {% endblock %} 25 | -------------------------------------------------------------------------------- /client/android/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /client/android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | piCar 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /client/csharp/WangHeng.Org.PiCar.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WangHeng.Org.PiCar", "PiCar\WangHeng.Org.PiCar.csproj", "{2226C2DA-8BC6-43A5-8D43-1D58D6F366AB}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {2226C2DA-8BC6-43A5-8D43-1D58D6F366AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {2226C2DA-8BC6-43A5-8D43-1D58D6F366AB}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {2226C2DA-8BC6-43A5-8D43-1D58D6F366AB}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {2226C2DA-8BC6-43A5-8D43-1D58D6F366AB}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /client/csharp/PiCar/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.18444 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WangHeng.Org.PiCar.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /client/csharp/PiCar/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("PiCar")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("WangHeng.Org")] 12 | [assembly: AssemblyProduct("PiCar")] 13 | [assembly: AssemblyCopyright("Copyright © WangHeng.org 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("2beeadaa-43f4-40e5-a254-6cf577e4bda0")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /server/pi_car/__init__.py: -------------------------------------------------------------------------------- 1 | ''' 2 | #============================================================================= 3 | # FileName: __init__.py 4 | # Desc: 5 | # Author: wangheng 6 | # Email: wujiwh@gmail.com 7 | # HomePage: http://wangheng.org 8 | # Version: 0.0.1 9 | # LastChange: 2015-01-14 13:49:06 10 | # History: 11 | #============================================================================= 12 | ''' 13 | import sqlite3 14 | from flask import Flask, request, session, g, redirect, url_for, \ 15 | abort, render_template, flash 16 | from contextlib import closing 17 | 18 | app = Flask(__name__) 19 | app.config.from_object('pi_car.config.Development') 20 | 21 | def connect_db(): 22 | return sqlite3.connect(app.config['DATABASE']) 23 | 24 | def init_db(): 25 | with closing(connect_db()) as db: 26 | with app.open_resource('init.sql',mode='r') as f: 27 | ad.cursor().executescript(f.read()) 28 | db.commit() 29 | 30 | #@app.before_request 31 | #def before_request(): 32 | # g.db = connect_db() 33 | #@app.teardown_request 34 | # def teardown_request(exception): 35 | # db = getattr(g, 'db', None) 36 | # if db is not None: 37 | # db.close() 38 | # g.db.close() 39 | 40 | import pi_car.views 41 | 42 | if __name__=='__main__': 43 | app.run() 44 | -------------------------------------------------------------------------------- /client/android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /server/pi_car/templates/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Car WebUI 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |

WebUI

19 |
20 | 项目地址:https://github.com/wujiwh/piCar 21 |
22 |
23 |
24 | {% block body %}{% endblock %} 25 |
26 |
27 | 30 |
31 |
32 | 33 | 34 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /server/pi_car/static/style.css: -------------------------------------------------------------------------------- 1 | /*============================================================================= 2 | # FileName: style.css 3 | # Desc: 4 | # Author: wangheng 5 | # Email: wujiwh@gmail.com 6 | # HomePage: http://wangheng.org 7 | # Version: 0.0.1 8 | # LastChange: 2015-01-14 20:40:04 9 | # History: 10 | =============================================================================*/ 11 | body { font-family: sans-serif; background: #eee; } 12 | a, h1, h2 { color: #377ba8; } 13 | h1, h2 { font-family: 'Georgia', serif; margin: 0; } 14 | h1 { border-bottom: 2px solid #eee; } 15 | h2 { font-size: 1.2em; } 16 | 17 | .page { margin: 2em auto; width: 60em; border: 5px solid #ccc; 18 | padding: 0.8em; background: white; } 19 | .entries { list-style: none; margin: 0; padding: 0; } 20 | .entries li { margin: 0.8em 1.2em; } 21 | .entries li h2 { margin-left: -1em; } 22 | .add-entry { font-size: 0.9em; border-bottom: 1px solid #ccc; } 23 | .add-entry dl { font-weight: bold; } 24 | .metanav { text-align: right; font-size: 0.8em; padding: 0.3em; 25 | margin-bottom: 1em; background: #fafafa; } 26 | .flash { background: #cee5F5; padding: 0.5em; 27 | border: 1px solid #aacbe2; } 28 | .error { background: #f0d6d6; padding: 0.5em; } 29 | 30 | .button_ctl { 31 | font: 12px Tahoma, Verdana; 32 | padding: 0 5px; 33 | color: #D3E0E7; 34 | cursor:pointer; 35 | background-repeat: no-repeat; 36 | background-position: 0 50%; 37 | outline: 0px solid #D3E0E7; 38 | border: 0px solid #FFF !important; 39 | line-height: 17px; 40 | } 41 | th { 42 | font-weight: bold; 43 | height: 96px; 44 | width: 96px; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /server/pi_car/views.py: -------------------------------------------------------------------------------- 1 | ''' 2 | #============================================================================= 3 | # FileName: views.py 4 | # Desc: 5 | # Author: wangheng 6 | # Email: wujiwh@gmail.com 7 | # HomePage: http://wangheng.org 8 | # Version: 0.0.1 9 | # LastChange: 2015-01-14 13:46:29 10 | # History: 11 | #============================================================================= 12 | ''' 13 | from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash 14 | from contextlib import closing 15 | from pi_car import app 16 | import re 17 | import RPi.GPIO as GPIO 18 | @app.route('/') 19 | def show_index(): 20 | return render_template('home.html') 21 | 22 | @app.route("/login", methods=["GET", "POST"]) 23 | def login(): 24 | if request.method=="GET": 25 | return "get"+request.form["user"] 26 | elif request.method=="POST": 27 | return "post" 28 | 29 | @app.route('/ctl',methods=['GET','POST']) 30 | def ctrl_id(): 31 | if request.method == 'POST': 32 | id=request.form['id'] 33 | GPIO.setmode(GPIO.BOARD) 34 | GPIO.setwarnings(False) 35 | GPIO.setup(11,GPIO.OUT) 36 | GPIO.setup(12,GPIO.OUT) 37 | GPIO.setup(15,GPIO.OUT) 38 | GPIO.setup(16,GPIO.OUT) 39 | 40 | if id == 't_left': 41 | t_left() 42 | return "left" 43 | elif id == 't_right': 44 | t_right() 45 | return "right" 46 | elif id == 't_up': 47 | t_up() 48 | return "up" 49 | elif id == 't_down': 50 | t_down() 51 | return "down" 52 | elif id == 't_stop': 53 | t_stop() 54 | return "stop" 55 | 56 | return redirect(url_for('show_index')) 57 | 58 | def t_stop(): 59 | GPIO.output(11, False) 60 | GPIO.output(12, False) 61 | GPIO.output(15, False) 62 | GPIO.output(16, False) 63 | 64 | def t_up(): 65 | GPIO.output(11, True) 66 | GPIO.output(12, False) 67 | GPIO.output(15, True) 68 | GPIO.output(16, False) 69 | 70 | def t_down(): 71 | GPIO.output(11, False) 72 | GPIO.output(12, True) 73 | GPIO.output(15, False) 74 | GPIO.output(16, True) 75 | 76 | def t_left(): 77 | GPIO.output(11, False) 78 | GPIO.output(12, True) 79 | GPIO.output(15, True) 80 | GPIO.output(16, False) 81 | 82 | def t_right(): 83 | GPIO.output(11, True) 84 | GPIO.output(12, False) 85 | GPIO.output(15, False) 86 | GPIO.output(16, True) 87 | 88 | -------------------------------------------------------------------------------- /client/csharp/PiCar/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.18444 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WangHeng.Org.PiCar.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WangHeng.Org.PiCar.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 使用此强类型资源类,为所有资源查找 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /client/android/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 16 | 17 |