基于手机蓝牙的遥控小车的设计与制作(编辑修改稿)内容摘要:

r==39。 A39。 ) { if(dir=1830 ) { dir=5。 TIM_SetCompare1(TIM4,dir)。 } else。 //left } else if(get_order==39。 S39。 ) { if(speed=3099 ) { speed+=500。 if(speed0) { GPIO_ResetBits(GPIOA, GPIO_Pin_4 | GPIO_Pin_5)。 TIM_SetCompare3(TIM1,speed)。 TIM_SetCompare4(TIM1,speed)。 } else { GPIO_SetBits(GPIOA, GPIO_Pin_4 | GPIO_Pin_5)。 set_speed=speed。 TIM_SetCompare3(TIM1,set_speed)。 TIM_SetCompare4(TIM1,set_speed)。 } } else。 //back } else if(get_order==39。 W39。 ) { if(speed=3099 ) { speed=500。 if(speed0) { GPIO_ResetBits(GPIOA, GPIO_Pin_4 | GPIO_Pin_5)。 TIM_SetCompare3(TIM1,speed)。 TIM_SetCompare4(TIM1,speed)。 } else { GPIO_SetBits(GPIOA, GPIO_Pin_4 | GPIO_Pin_5)。 set_speed=speed。 TIM_SetCompare3(TIM1,set_speed)。 TIM_SetCompare4(TIM1,set_speed)。 } } else。 //forward } else if(get_order==39。 P39。 ) { speed=0。 GPIO_SetBits(GPIOA, GPIO_Pin_4 | GPIO_Pin_5)。 //急刹 TIM_SetCompare3(TIM1,3599)。 TIM_SetCompare4(TIM1,3599)。 //stop } else { USART_RX_STA=0。 //接收数据错误 ,重新开始接收 } } else { USART_RX_STA=0。 //接收数据错误 ,重新开始接收 } } else { USART_RX_BUF[USART_RX_STA]=Res。 USART_RX_STA++。 if(USART_RX_STA(USART_REC_LEN1)) { USART_RX_STA=0。 //接收数据错误 ,重新开始接收 } } } 附蓝牙 程序源码 : ?xml version= encoding=utf8? RelativeLayout xmlns:android= android:layout_width=match_parent android:layout_height=match_parent android:orientation=vertical ImageButton android:id=@+id/imageButton2 android:layout_width=wrap_content android:layout_height=wrap_content android:layout_below=@+id/imageButton3 android:layout_toRightOf=@+id/imageButton4 android:contentDescription=@string/down android:src=@drawable/ic_down / ImageButton android:id=@+id/imageButton3 android:layout_width=wrap_content android:layout_height=wrap_content android:layout_below=@+id/imageButton1 android:layout_toRightOf=@+id/imageButton2 android:contentDescription=@string/right android:src=@drawable/ic_right / ImageButton android:id=@+id/imageButton1 android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignParentTop=true android:layout_marginTop=90dp android:layout_toLeftOf=@+id/imageButton3 android:contentDescription=@string/up android:src=@drawable/ic_up / ImageButton android:id=@+id/imageButton6 android:layout_width=wrap_content android:layout_height=wrap_content android:layout_alignLeft=@+id/imageButton3 android:layout_below=@+id/imageButton2 android:layout_marginLeft=22dp android:layout_marginTop=25dp android:contentDescription=@string/stop android:src=@drawable/ic_stop / ImageButton android:id=@+id。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。