conflict ports changed

This commit is contained in:
clf3 2023-09-08 00:52:41 +08:00
parent d901d7a080
commit b5f240f1b2
2 changed files with 13 additions and 9 deletions

View File

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

View File

@ -4,7 +4,7 @@
#include "Arduino.h"
#include "HardwareSerial.h"
#include<Servo.h>
#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);
}