conflict ports changed
This commit is contained in:
parent
d901d7a080
commit
b5f240f1b2
|
@ -35,19 +35,21 @@ void send(){
|
||||||
sending_signal+=rudder*1000;
|
sending_signal+=rudder*1000;
|
||||||
sending_signal+=1000000;
|
sending_signal+=1000000;
|
||||||
radio.write(&sending_signal,sizeof(sending_signal));
|
radio.write(&sending_signal,sizeof(sending_signal));
|
||||||
Serial.println(propeller);
|
// Serial.println(propeller);
|
||||||
Serial.println(rudder);
|
// Serial.println(rudder);
|
||||||
Serial.print("propeller sent ");
|
// Serial.print("propeller sent ");
|
||||||
Serial.println(propeller);
|
// Serial.println(propeller);
|
||||||
Serial.print("rudder sent ");
|
// Serial.print("rudder sent ");
|
||||||
Serial.println(rudder);
|
// Serial.println(rudder);
|
||||||
Serial.println(sending_signal);
|
// Serial.println(sending_signal);
|
||||||
radio.startListening();
|
radio.startListening();
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
// put your main code here, to run repeatedly:
|
// put your main code here, to run repeatedly:
|
||||||
if(radio.available()){
|
if(radio.available()){
|
||||||
|
|
||||||
radio.read(&response,sizeof(response));
|
radio.read(&response,sizeof(response));
|
||||||
|
Serial.println(response);
|
||||||
if(response%1000000==1){
|
if(response%1000000==1){
|
||||||
sending=String(response);
|
sending=String(response);
|
||||||
sendingSerial.print(sending);
|
sendingSerial.print(sending);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include "HardwareSerial.h"
|
#include "HardwareSerial.h"
|
||||||
#include<Servo.h>
|
#include<Servo.h>
|
||||||
#define trigPin 6 //超声波模块的Trig口 6#
|
#define trigPin 2 //超声波模块的Trig口 6#
|
||||||
#define echoPin 5 //超声波模块的echo口 5#
|
#define echoPin 5 //超声波模块的echo口 5#
|
||||||
#define ServoPin 3 //底座舵机端口 3#
|
#define ServoPin 3 //底座舵机端口 3#
|
||||||
unsigned long time=0;
|
unsigned long time=0;
|
||||||
|
@ -74,6 +74,7 @@ long confirm(long x){
|
||||||
}
|
}
|
||||||
void loop() {
|
void loop() {
|
||||||
radio.startListening();
|
radio.startListening();
|
||||||
|
delay(20);
|
||||||
if(radio.available()){
|
if(radio.available()){
|
||||||
radio.read(&content,sizeof(content));
|
radio.read(&content,sizeof(content));
|
||||||
Serial.println("The content is");
|
Serial.println("The content is");
|
||||||
|
@ -178,6 +179,7 @@ void loop() {
|
||||||
response=2000000;
|
response=2000000;
|
||||||
}
|
}
|
||||||
radio.write(response,sizeof(response));
|
radio.write(response,sizeof(response));
|
||||||
delay(20-distance/17);
|
//delay(20-distance/17);
|
||||||
|
Serial.println(distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue