You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Play/WebSocket3Aqva/outconvert.ino

74 lines
1.8 KiB

void outconvert()
{ int led;
bool outl;
int j=0;
for (int i = 0; i < ledout.length() ; i++) {//перебираем строку данных {"ido":"4","out":"1"}
if (ledout[i]==':')
{j++;
if (j==1)//первое :
{ if (ledout[i+3]!='\"')
{
led=int(ledout[i+2] - '0')*10+int(ledout[i+3] - '0');
}
else
{ led=int(ledout[i+2] - '0');
}
}
if (j==2)//второе :
{outl=int(ledout[i+2] - '0');
}
}
}
switch (led) {
case 4:
state1=outl;
gpio[0]=outl;
gpio[3]=0;
break;
case 26:
state2=outl;
gpio[1]=outl;
gpio[3]=0;
// BTimer2[0]=3;
break;
case 27:
state3=outl;
gpio[2]=outl;
gpio[3]=0;
// BTimer3[0]=3;
break;
case 55:
//таймер или кнопки
//state1=outl;
gpio[3]=outl;
break;
}
if( gpio[3]==0)//1-управление выходами через таймер 0- через кнопки
{ BTimer1[0]=3;
BTimer2[0]=3;
BTimer3[0]=3;
}
else
{
BTimer1[0]=2;
BTimer2[0]=2;
BTimer3[0]=2;
btime();
}
digitalWrite(led, outl);
Serial.print(state1);
Serial.print(state2);
Serial.println(state3);
Serial.print("led");
Serial.print(led);
Serial.print(":");
Serial.println(outl);
}