From b5f240f1b23b7e350e6918078a348a54c3e86c0a Mon Sep 17 00:00:00 2001 From: clf3 Date: Fri, 8 Sep 2023 00:52:41 +0800 Subject: [PATCH] conflict ports changed --- remote_controler/remote_controler.ino | 16 +++++++++------- ship/ship.ino | 6 ++++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/remote_controler/remote_controler.ino b/remote_controler/remote_controler.ino index c636cca..e621535 100644 --- a/remote_controler/remote_controler.ino +++ b/remote_controler/remote_controler.ino @@ -35,19 +35,21 @@ void send(){ sending_signal+=rudder*1000; sending_signal+=1000000; radio.write(&sending_signal,sizeof(sending_signal)); - Serial.println(propeller); - Serial.println(rudder); - Serial.print("propeller sent "); - Serial.println(propeller); - Serial.print("rudder sent "); - Serial.println(rudder); - Serial.println(sending_signal); + // Serial.println(propeller); + // Serial.println(rudder); + // Serial.print("propeller sent "); + // Serial.println(propeller); + // Serial.print("rudder sent "); + // Serial.println(rudder); + // Serial.println(sending_signal); radio.startListening(); } void loop() { // put your main code here, to run repeatedly: if(radio.available()){ + radio.read(&response,sizeof(response)); + Serial.println(response); if(response%1000000==1){ sending=String(response); sendingSerial.print(sending); diff --git a/ship/ship.ino b/ship/ship.ino index 7521b12..6fa10ab 100644 --- a/ship/ship.ino +++ b/ship/ship.ino @@ -4,7 +4,7 @@ #include "Arduino.h" #include "HardwareSerial.h" #include -#define trigPin 6 //超声波模块的Trig口 6# +#define trigPin 2 //超声波模块的Trig口 6# #define echoPin 5 //超声波模块的echo口 5# #define ServoPin 3 //底座舵机端口 3# unsigned long time=0; @@ -74,6 +74,7 @@ long confirm(long x){ } void loop() { radio.startListening(); + delay(20); if(radio.available()){ radio.read(&content,sizeof(content)); Serial.println("The content is"); @@ -178,6 +179,7 @@ void loop() { response=2000000; } radio.write(response,sizeof(response)); - delay(20-distance/17); + //delay(20-distance/17); + Serial.println(distance); }