سلام من تو آردوینو یه برنامه نوشتم برای ارتباط با یه ریموت RF که با آی سی چهار کاناله PT2262 یه کد ارسال می کنه ولی آردوینو حتی وقتی هیچی بهش وصل نیست شروع می کنه به نشون دادن اعداد اونم فقط هرجا temp4 باشه و کد 5 باقی رو اگر چیزی وصل نباشه نشون نمی ده
اینم کدی که نوشتم
void setup() {
// put your setup code here, to run once:
pinMode(10, INPUT);
pinMode(11, INPUT);
pinMode(12, INPUT);
pinMode(13, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int temp1=digitalRead(10);
int temp2=digitalRead(11);
int temp3=digitalRead(12);
int temp4=digitalRead(13);
if(temp1==1 && temp2==0 && temp3==0 && temp4==0)
Serial.print("2 ");
else if(temp1==0 && temp2==0 && temp3==0 && temp4==1)
Serial.print("1 ");
else if(temp1==0 && temp2==0 && temp3==1 && temp4==0)
Serial.print("3 ");
else if(temp1==0 && temp2==1 && temp3==0 && temp4==0)
Serial.print("4 ");
else
Serial.print("5 ");
}
به نظرتون از چیه ؟
اینم بگم که من تازه کارم
اینم کدی که نوشتم
void setup() {
// put your setup code here, to run once:
pinMode(10, INPUT);
pinMode(11, INPUT);
pinMode(12, INPUT);
pinMode(13, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int temp1=digitalRead(10);
int temp2=digitalRead(11);
int temp3=digitalRead(12);
int temp4=digitalRead(13);
if(temp1==1 && temp2==0 && temp3==0 && temp4==0)
Serial.print("2 ");
else if(temp1==0 && temp2==0 && temp3==0 && temp4==1)
Serial.print("1 ");
else if(temp1==0 && temp2==0 && temp3==1 && temp4==0)
Serial.print("3 ");
else if(temp1==0 && temp2==1 && temp3==0 && temp4==0)
Serial.print("4 ");
else
Serial.print("5 ");
}
به نظرتون از چیه ؟
اینم بگم که من تازه کارم
دیدگاه