Coder Social home page Coder Social logo

amazingplace / car_remote_control Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hongfeiyucode/car_remote_control

0.0 0.0 0.0 17.79 MB

手机通过蓝牙控制汽车行驶并支持重力感应与触摸两种模式

License: GNU General Public License v3.0

Java 100.00%

car_remote_control's Introduction

STM32 手机 蓝牙遥控 循迹 寻光 重力感应小车

遥控效果慢放N倍

zlgy

GIF演示

重力感应遥控说明:

  • 将手机树立起来时小车是停止状态
  • 想象手机是一个遥杆
  • 往前倾(手机上端远离自己)是向前,往后是后退
  • 左右倾斜分别是向左转向右转

Android遥控程序

这个是工程量比较大的一个项目,源代码:https://github.com/hongfeiyucode/Car_remote_control

最后的程序大致界面,基本是重新改写了一遍。后期还加了重力感应这一功能。

app-1

app-2

操作说明:

  • 打开程序
  • 点击主界面的打开蓝牙
  • 拖出侧面的侧边栏
  • 点击查找蓝牙设备
  • 匹配小车的蓝牙
  • 连接成功后已经开始进入重力感应遥控模式了
  • 右下角的按钮可以切换重力感应与键盘操作模式
  • 两种模式各有各的特点,找到自己的喜欢的就好

app-3

重力感应模式

app-4


很多设备调试,程序编写都是自己一个人一行一行一根线一根线调试出来的, 从中体会到了很多酸甜苦辣。其中调试小车让其识别拐弯与平时的轻度弯曲的直线之间的区别是最让人痛苦的,不过小车最后还是跑出了全专业最快的10秒/圈的速度。

PS:此文中的小车的循迹程序寻光程序Android遥控程序重力感应程序循迹与寻光自由切换程序 已全部上传至网上。

最终效果

小车最终外观

car2

处理器用的是STM32F4

car3

后面两个轮子为驱动轮,前面一个轮子为从动轮


寻光

car1

这架在上面的是就是寻光传感器,最后考核很是蛋疼,很多人写的程序直接就是转180度然后car_forward() 检测到光直接停下,这种当然是最快的,但是因为前面说过的我这小车无法直行最后跑的不是很快。

但是程序的逻辑还是很具有参考价值的: https://github.com/hongfeiyucode/find_light_car

循迹

enter image description here

GIF演示

这只是初期程序的效果,考核的时候已经不会在直线上扭来扭去了。但其实有的人的车不调也能到达差不多的效果,但无奈我的两个马达转速差别太大,调节也无法完全走直线。所以必须用程序做到将其完全可控。

并且程序在检测到需要转弯时两个轮子是一前一后地转动,能够以最大限度的提供动力使车身转向并且还在直线上,当检测到转过的角度到达时车会立即继续向前开动。

最终程序源代码:https://github.com/hongfeiyucode/find_way_car

循迹与寻光自由切换

这个主要是利用芯片上的一个按钮将其进行程序之间的切换。程序检测一个值,检测这个键是否按下,还有什么时候弹起,来达到两个程序之间切换的功能。

也另外写了一个程序,程序还是很简洁明了的: https://github.com/hongfeiyucode/car_find_way_and_light

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.