15-01-2017, 16:12
Witam, programuję centralkę alarmową sterowaną za pomocą smsów, udało mi się zrobić aby program reagował na jeden numer telefonu ale nie wiem jak dodać kolejny. Przedstawię to na prostym przykładzie:
void setup() {
Serial.begin(9600); // set serial port at desired value
Serial.println("serial find test"); // echo test
}
void loop() {
while (Serial.available())
{
if (Serial.find("kolega") and Serial.find("2") or Serial.find("kot") and Serial.find("2"))
{
Serial.println("Found!");
}
}
}
próbowałem też tak:
void setup() {
Serial.begin(9600); // set serial port at desired value
Serial.println("serial find test"); // echo test
}
void loop() {
while (Serial.available())
{
if (Serial.find("kolega") and Serial.find("2"))
{
Serial.println("Found!");
}
else
{
if (Serial.find("kot") and Serial.find("2"))
{
Serial.println("Found");
}
}
}
}
Found jest zwracane tylko po wpisaniu kolega 2, jak zrobić aby reagował także na kota 2?
void setup() {
Serial.begin(9600); // set serial port at desired value
Serial.println("serial find test"); // echo test
}
void loop() {
while (Serial.available())
{
if (Serial.find("kolega") and Serial.find("2") or Serial.find("kot") and Serial.find("2"))
{
Serial.println("Found!");
}
}
}
próbowałem też tak:
void setup() {
Serial.begin(9600); // set serial port at desired value
Serial.println("serial find test"); // echo test
}
void loop() {
while (Serial.available())
{
if (Serial.find("kolega") and Serial.find("2"))
{
Serial.println("Found!");
}
else
{
if (Serial.find("kot") and Serial.find("2"))
{
Serial.println("Found");
}
}
}
}
Found jest zwracane tylko po wpisaniu kolega 2, jak zrobić aby reagował także na kota 2?