赞
踩
#include <SoftwareSerial.h>
// Pin10接HC05的TXD
// Pin1接HC05的RXD
SoftwareSerial BT(0, 1);
char val;
int L1_IN1 = 7;int L1_IN2 = 5;int L1_ENA = 6;//左前轮
int R1_IN1 = 4;int R1_IN2 = 2;int R1_ENA = 3;//右前轮
int L2_IN1 = 12;int L2_IN2 = 13;int L2_ENA = 11;//左后轮
int R2_IN1 = 8;int R2_IN2 = 9;int R2_ENA = 10;//右后轮
int sp=200;
void setup() {
// put your setup code here, to run once:
pinMode(L1_IN1, OUTPUT);pinMode(L1_IN2, OUTPUT);pinMode(L1_ENA, OUTPUT);
pinMode(R1_IN1, OUTPUT);pinMode(R1_IN2, OUTPUT);pinMode(R1_ENA, OUTPUT);
pinMode(L2_IN1, OUTPUT);pinMode(L2_IN2, OUTPUT);pinMode(L2_ENA, OUTPUT);
pinMode(R2_IN1, OUTPUT);pinMode(R2_IN2, OUTPUT);pinMode(R2_ENA, OUTPUT);
Serial.begin(9600);
Serial.println("bluetooth is ready!");
BT.begin(9600);
}
void loop()
{
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。