Raspberry Pi2 Smart Car source code and test video

Source: Internet
Author: User

Xiaobo qq:463431476

Reprint please indicate the author
Python Source Code

Import Rpi.gpio as gpio  #human-computer-interactionimport curses  import time from curses Import Wrapper   gpio.setmode (GPIO). BCM)     #left_moto_goGPIO. Setup (GPIO. Out) #IN1  gpio.setup (GPIO). Out) #IN3 #left_moto_backgpio.setup (12,gpio. Out) #IN2  gpio.setup (25,gpio. Out) #IN4     #right_moto_goGPIO. Setup (GPIO. Out) #IN5  gpio.setup (GPIO). Out) #IN7 #right_moto_backgpio.setup (17,gpio. Out) #IN6  gpio.setup (8,gpio. Out) #IN8  STDSCR = CURSES.INITSCR ()   stdscr.clear ()     while True:       ch = stdscr.getkey ()     #EXIT      if ch = = ' E ':        Curs Es.endwin ()                  break  # forward    & nbsp if ch = = ' W ':         gpio.output (27,gpio. High)          gpio.output (18,gpio. High) &NBSp             gpio.output (12,gpio. Low)         gpio.output (25,gpio. Low)         gpio.output (22,gpio. High)          gpio.output (23,gpio. High)         gpio.output (17,gpio. Low)         gpio.output (8,gpio. Low)         time.sleep (0.3)               gpio.output ( 27,gpio. Low)          gpio.output (18,gpio. Low)          gpio.output (22,gpio. Low)                gpio.output (23,gpio. Low)          gpio.output (12,gpio. Low)         gpio.output (25,gpio. Low)         gpio.output (17,gpio. Low)         gpio.output (8,gpio. Low)  # backward      if ch = = ' s ':  &Nbsp;        Gpio.output (27,gpio. Low)           Gpio.output (18,gpio. Low)           Gpio.output (12,gpio. High)          Gpio.output (25,gpio. High)          Gpio.output (17,gpio. High)          Gpio.output (8,gpio. High)          Gpio.output (22,gpio. Low)                 Gpio.output (23,gpio. Low          Time.sleep (0.3)                Gpio.output (2 7,gpio. Low)           Gpio.output (18,gpio. Low)           Gpio.output (22,gpio. Low)                 Gpio.output (23,gpio. Low)           Gpio.output (12,gpio. Low)          Gpio.output (25,gpio. Low)        &NBSP Gpio.output (17,gpio. Low)          Gpio.output (8,gpio. Low)          # Turn right      if ch = = ' d ':      &N Bsp  gpio.output (27,gpio. High)          gpio.output (18,gpio. High)         gpio.output (12,gpio. Low)         gpio.output (25,gpio. Low)         gpio.output (17,gpio. High)          gpio.output (8,gpio. High)          gpio.output (22,gpio. Low)                gpio.output (23,gpio. Low)          time.sleep (0.3)                Gpio.output (27,gpio. Low)          gpio.output (18,gpio. Low)          gpio.output (22,gpio. Low)               &NBsp Gpio.output (23,gpio. Low)          gpio.output (12,gpio. Low)         gpio.output (25,gpio. Low)         gpio.output (17,gpio. Low)         gpio.output (8,gpio. Low)  # Turn left      if ch = = ' A ':         gpio.output (22,gpio. High)          gpio.output (23,gpio. High)               gpio.output (17,gpio. Low)         gpio.output (8,gpio. Low)         gpio.output (12,gpio. High)          gpio.output (25,gpio. High)               gpio.output (27,gpio. Low)          gpio.output (18,gpio. Low)          time.sleep (0.3)                Gpio.output (27,gpio. Low)         gpio.output (18,gpio. Low)          gpio.output (22,gpio. Low)                gpio.output (23,gpio. Low)          gpio.output (12,gpio. Low)         gpio.output (25,gpio. Low)         gpio.output (17,gpio. Low)         gpio.output (8,gpio. Low)        Below is the test video   



Raspberry Pi2 Smart Car source code and test video

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.