61 lines
1 KiB
Plaintext
61 lines
1 KiB
Plaintext
|
byte val = 0;
|
||
|
byte val2 = 0;
|
||
|
|
||
|
byte cab=0;
|
||
|
byte command=0;
|
||
|
byte dat=0;
|
||
|
|
||
|
int count=0;
|
||
|
int countr=0;
|
||
|
int N=100;
|
||
|
|
||
|
int RSSI=6;
|
||
|
int CTS=7;
|
||
|
|
||
|
void setup()
|
||
|
{
|
||
|
Serial.begin(9600);
|
||
|
pinMode(RSSI, INPUT);
|
||
|
pinMode(CTS, INPUT);
|
||
|
delay(100);
|
||
|
}
|
||
|
|
||
|
void loop()
|
||
|
{
|
||
|
/*if (Serial.available()) {
|
||
|
val = Serial.read();
|
||
|
if (val==0xF0)
|
||
|
{
|
||
|
count=1;
|
||
|
cab=val;
|
||
|
}
|
||
|
else if (count==1)
|
||
|
{
|
||
|
count=2;
|
||
|
command=val;
|
||
|
}
|
||
|
else if (count==2)
|
||
|
{
|
||
|
count=3;
|
||
|
dat=val;
|
||
|
}
|
||
|
}
|
||
|
if (count==3)
|
||
|
{
|
||
|
count=0;
|
||
|
while(digitalRead(CTS));
|
||
|
Serial.print(cab, BYTE);
|
||
|
while(digitalRead(CTS));
|
||
|
Serial.print(command, BYTE);
|
||
|
while(digitalRead(CTS));
|
||
|
Serial.print(dat, BYTE);
|
||
|
}*/
|
||
|
|
||
|
if (Serial.available()) {
|
||
|
val = Serial.read();
|
||
|
while(digitalRead(CTS));
|
||
|
Serial.print(val, BYTE);
|
||
|
}
|
||
|
}
|
||
|
|