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); }