Fórum témák

» Több friss téma
Fórum » Arduino
A klónok CH340 Soros-USB illesztőjének drivere (Letöltés)
Lapozás: OK   265 / 864
(#) kapu48 válasza sany hozzászólására (») Szept 25, 2016 /
 
Nekem gondnélkül lefordul!

Az Eszközöknél kiválasztottad az Unot?
(#) TavIR-AVR válasza sany hozzászólására (») Szept 25, 2016 /
 
Jogosultsági probléma lesz. Azonban közelebb visza megfejtéshez:
- Milyen arduino verzió? cc v. org + verziószám
- Oprendszer?

File - Beállítások alatt a log mutatása-t kapcsold be...
(#) sany válasza TavIR-AVR hozzászólására (») Szept 25, 2016 /
 
A verzió cc és azt hiszem R3. Windows XP -n futtatva. 1.6.12 verziójú a program.

Board info:
BN: Arduino/Genuino Uno
VID: 2341
PID: 0243
SN: 85534313837351302292
(#) Gabó válasza sany hozzászólására (») Szept 25, 2016 /
 
Próbáld egy régebbivel. Nálam jó az 1,5,7el
(#) zsolt58 hozzászólása Szept 25, 2016 /
 
Szerintetek ez jó?
Arduino+PIR szenzor+GSM SIM900.
Ez működhet?

  1. /*
  2. * //////////////////////////////////////////////////
  3. * //making sense of the Parallax PIR sensor's output
  4. * //////////////////////////////////////////////////
  5. *
  6. * Switches a LED according to the state of the sensors output pin.
  7. * Determines the beginning and end of continuous motion sequences.
  8. *
  9. * @author: Kristian Gohlke / krigoo (_) gmail (_) com / http://krx.at
  10. * @date:   3. September 2006
  11. *
  12. * kr1 (cleft) 2006
  13. * released under a creative commons "Attribution-NonCommercial-ShareAlike 2.0" license
  14. *
  15. *
  16. * The Parallax PIR Sensor is an easy to use digital infrared motion sensor module.
  17. * (http://www.parallax.com/detail.asp?product_id=555-28027)
  18. *
  19. * The sensor's output pin goes to HIGH if motion is present.
  20. * However, even if motion is present it goes to LOW from time to time,
  21. * which might give the impression no motion is present.
  22. * This program deals with this issue by ignoring LOW-phases shorter than a given time,
  23. * assuming continuous motion is present during these phases.
  24. *  
  25. */
  26.  
  27. /////////////////////////////
  28. //VARS
  29. //the time we give the sensor to calibrate (10-60 secs according to the datasheet)
  30. #include "SIM900.h"
  31. #include <SoftwareSerial.h>
  32. #include "sms.h"
  33. SMSGSM sms;
  34. #include <GSM.h>
  35. boolean PIR1=false;
  36. boolean PIR2=false;
  37. int calibrationTime = 30;        
  38.  
  39. //the time when the sensor outputs a low impulse
  40. long unsigned int lowIn1;      
  41. long unsigned int lowIn2;            
  42.  
  43. //the amount of milliseconds the sensor has to be low
  44. //before we assume all motion has stopped
  45. long unsigned int pause = 100;  
  46.  
  47. boolean lockLow1 = true;
  48. boolean takeLowTime1;  
  49. boolean lockLow2 = true;
  50. boolean takeLowTime2;
  51.  
  52. int pirPin2 = 10;
  53. int pirPin1 = 3;    //the digital pin connected to the PIR sensor's output
  54. int ledPin = 7;
  55. int flag1=0;
  56. int flag2=0;
  57. int ctr=0;
  58.  
  59. /////////////////////////////
  60. //SETUP
  61. void setup(){
  62.  Serial.begin(9600);
  63.  pinMode(pirPin1, INPUT);
  64.  pinMode(pirPin2, INPUT);
  65.  pinMode(ledPin, OUTPUT);
  66.  digitalWrite(pirPin1, LOW);
  67.  digitalWrite(pirPin2, LOW);
  68.  //give the sensor some time to calibrate
  69.  Serial.print("calibrating sensor ");
  70.    for(int i = 0; i < calibrationTime; i++){
  71.      Serial.print(".");
  72.      delay(1000);
  73.      }
  74.    Serial.println(" done");
  75.    Serial.println("SENSOR ACTIVE");
  76.    delay(50);
  77.    
  78.    //Serial connection.
  79.   Serial.begin(9600);
  80.   Serial.println("GSM Shield testing.");
  81.  
  82.  
  83.  }
  84.  
  85. ////////////////////////////
  86. //LOOP
  87. void loop(){
  88.  static int relayVal = 0;
  89.  
  90.     if(digitalRead(pirPin1) == HIGH){
  91.     //the led visualizes the sensors output pin state
  92.       if(lockLow1){  
  93.         //makes sure we wait for a transition to LOW before any further output is made:
  94.         lockLow1 = false;  
  95.         Serial.println("");          
  96.         Serial.print(" Motion Detected PIR1 ");
  97.         delay(50);
  98.         flag1=1;
  99.         if(flag2==1)
  100.         {
  101.          ctr=ctr+1;
  102.          flag1=0;
  103.          flag2=0;
  104.          if(ctr<=0)
  105.                  digitalWrite(ledPin, LOW);
  106.                    if(ctr>0)
  107.                  digitalWrite(ledPin, HIGH);
  108.         }
  109.      
  110.         }        
  111.         takeLowTime1 = true;
  112.       }
  113. //*************8
  114.  
  115.     if(digitalRead(pirPin2) == HIGH){
  116.        //the led visualizes the sensors output pin state
  117.       if(lockLow2){  
  118.         //makes sure we wait for a transition to LOW before any further output is made:
  119.         lockLow2 = false;  
  120.         Serial.println("");        
  121.         Serial.print(" Motion Detected PIR2 ");
  122.           //Serial.println(flag1);
  123.          //Serial.println(flag2);
  124.         delay(50);
  125.          flag2=1;
  126.         if(flag1==1)
  127.         {
  128.          ctr=ctr-1;
  129.          flag1=0;
  130.          flag2=0;
  131.          if(ctr<=0)
  132.                  digitalWrite(ledPin, LOW);
  133.                    if(ctr>0)
  134.                  digitalWrite(ledPin, HIGH);
  135.         }
  136.      
  137.         }        
  138.         takeLowTime2 = true;
  139.       }
  140. //#####  
  141. //************
  142.  
  143.     if(digitalRead(pirPin1) == LOW){      
  144.       //digitalWrite(ledPin, LOW);  //the led visualizes the sensors output pin state
  145.  
  146.       if(takeLowTime1){
  147.        lowIn1 = millis();          //save the time of the transition from high to LOW
  148.        takeLowTime1 = false;       //make sure this is only done at the start of a LOW phase
  149.        }
  150.       //if the sensor is low for more than the given pause,
  151.       //we assume that no more motion is going to happen
  152.       if(!lockLow1 && millis() - lowIn1 > pause){  
  153.           //makes sure this block of code is only executed again after
  154.           //a new motion sequence has been detected
  155.           lockLow1 = true;                        
  156.           delay(50);
  157.           }
  158.       }
  159. //#####
  160. if(digitalRead(pirPin2) == LOW){      
  161.       //digitalWrite(ledPin, LOW);  //the led visualizes the sensors output pin state
  162.  
  163.       if(takeLowTime2){
  164.        lowIn2 = millis();          //save the time of the transition from high to LOW
  165.        takeLowTime2 = false;       //make sure this is only done at the start of a LOW phase
  166.        }
  167.       //if the sensor is low for more than the given pause,
  168.       //we assume that no more motion is going to happen
  169.       if(!lockLow2 && millis() - lowIn2 > pause){  
  170.           //makes sure this block of code is only executed again after
  171.           //a new motion sequence has been detected
  172.           lockLow2 = true;                      
  173.           delay(50);
  174.           }
  175.       };
  176. //#####
  177.    if (Serial.println("\nstatus= Motion Detected PIR1 "))
  178.     {PIR1=true;}
  179.   else if (Serial.println("\nstatus= Motion Detected PIR2 "))
  180.     {PIR2=true;}
  181.  
  182.   if(PIR1=true){
  183.      (sms.SendSMS( "+381611594988", "PIR1" ));
  184.       Serial.println("\nSMS sent OK 1");
  185.   }else if (PIR2=true){
  186.      (sms.SendSMS( "+381611594988", "PIR2" ));
  187.       Serial.println("\nSMS sent OK 2");
  188.   };
  189.  
  190. };


Vagy nem jó benne valami?
Üdv.
(#) sany válasza TavIR-AVR hozzászólására (») Szept 26, 2016 /
 
Az érdekes , hogy előtte írtam 4-5 db olyan egyszerűbb forráskódot, amiben használtam már a delay utasítást. Azoknál nem volt semmi probléma.
(#) sany válasza Gabó hozzászólására (») Szept 26, 2016 /
 
Köszi. Ezzel már lefordul hibamentesen.
(#) kapu48 válasza zsolt58 hozzászólására (») Szept 26, 2016 / 1
 
Szerintem ezek nem jók:
  1. if (Serial.println("\nstatus= Motion Detected PIR1 ")) <<<<?????
  2. ...
  3. if(PIR1=true)   <<<<????
(#) (Felhasználó 120038) válasza Szabi1 hozzászólására (») Szept 26, 2016 /
 
Szia!

  1. void motor_control(int my_delay)
  2.  
  3.  
  4. 28.{
  5.  
  6.  
  7. 29.    
  8.  
  9.  
  10. 30.
  11.  
  12.  
  13. 31.    digitalWrite(8, HIGH);
  14.  
  15.  
  16. 32.    delayMicroseconds(my_delay);
  17.  
  18.  
  19. 33.    delayMicroseconds(my_delay);
  20.  
  21.  
  22. 34.    delayMicroseconds(my_delay);
  23.  
  24.  
  25. 35.    digitalWrite(8, LOW);
  26.  
  27.  
  28. 36.    delayMicroseconds(my_delay);
  29.  
  30.  
  31. 37.    delayMicroseconds(my_delay);
  32.  
  33.  
  34. 38.    delayMicroseconds(my_delay);
  35.  
  36.  
  37. 39.          
  38.  
  39.  
  40. 40.            lcd.setCursor(0, 1);
  41.  
  42.  
  43. 41.            itoa(mytime, myData, 10);
  44.  
  45.  
  46. 42.            lcd.print(myData);
  47.  
  48.  
  49. 43.            lcd.setCursor(0, 0);
  50.  
  51.  
  52. 44.            itoa(max_step, myData, 10);
  53.  
  54.  
  55. 45.            lcd.print(myData);
  56.  
  57.  
  58. 46.}


Nem vágom a PWM-jeleket teljesen, de szerintem itt kell számolgatnod frekvenciát. Nem értem miért van 3x delay benne, ha elegendő lenne a mydelay értékét 3x-osára venni, úgy meghívni ezt a függvényt.

Van a delay-nél sokkal gyorsabb megoldás is, valaki korábban ide is belinkelte, érdekes videó!

AZ LCD kijelzés mindenképpen kiszervezném onnan, mert baromira lassítja szerintem, ezáltal ha számolsz is, nem lesz pontos!

A loopban, vagy máshonnan kellene a kiíratásokat csinálni, de azt is úgy, hogy kb minden tized másodpercben tegye.

Egyelőre ennyi, mert nincs időm, menem kell gályázni.

Említették neked a Timert, ami sokkal jobb lenne ide szerintem. (is)

Jelentkezek később!
A hozzászólás módosítva: Szept 26, 2016
(#) zsolt58 válasza kapu48 hozzászólására (») Szept 26, 2016 /
 
De miért nem?
Akkor mit kellene írni?
(#) kapu48 válasza zsolt58 hozzászólására (») Szept 26, 2016 / 1
 
if (Serial.println("\nstatus= Motion Detected PIR1 "))
A Serial.println() visszaadja a kiírt byte-ok számát:
Println
Returns
size_t (long): println() returns the number of bytes written, though reading that number is optional
Az if Megvizsgálja, ha nagyobb 0-ánál? Akkor mindig igaz a feltétel!

if(PIR1=true) PIR1 legyen egyenlő 1-el! Ez is mindig igaz lesz!

Helyesen: if(PIR1 == true) PIR1 egyenlő e 1-el?
If
A hozzászólás módosítva: Szept 26, 2016
(#) world-s hozzászólása Szept 27, 2016 /
 
Sziasztok!
Láttam gyárilag vannak lapkák ahol fogyasztók illesztését IRF 540-el oldják meg.
Nekem IRLR 024 NPBF-m van otthon jó pár.
Használhatom ezt is erre a célra?
Powerbankos működés, tehát fontos a kis vesztesé és kis hő.
Azt látom, hogy 44 helyett ez 65mΩ -os. Gondolom ez még nem akkora nagy különbség és vesztesé, de a hestore oldal szerint még pár dologban eltérnek.
ezért nem vagyok biztos benne.

Segítségeteket előre is köszönöm.
(#) RoliNyh válasza world-s hozzászólására (») Szept 27, 2016 /
 
Nyugodtan használhatod azt is.
A lényeg, hogy a maximális feszültség és áramtűrését ne lépd túl...
(#) world-s válasza RoliNyh hozzászólására (») Szept 27, 2016 /
 
Talán nem fogom. Nincs felfelé konvertálás feszben, és ha a Drén áram számít, akkor a 17A-t powerbakkal nem fog sikerülni
Főleg, hogy az egyes körökben max. 5-18 led lesz, hogy külön lehessen irányítani őket.

Amúgy valóban így minden nélkül a MOSFET beköthető (nem motorra, mert arra most már van egy komplett kapcsolás építve)?
Vagy tartós használat esetén (nem teszt) azért valamit még illik betenni?
Ugye nemcsak be és kikapcsolni szeretnék, hanem a PWM-el vezérelni is pl. a ledek fényerejét.

http://i.imgur.com/wHFchDt.jpg
(#) RoliNyh válasza world-s hozzászólására (») Szept 27, 2016 /
 
A PWM is csak be és kikapcsolás, csak épp nagy frekvenciával...

Azt hittem, ezen már túl vagy. És barátunk százszámra ad megvalósítható kapcsolást hozzá.

Arduino controll PWM MOSFET...
A hozzászólás módosítva: Szept 27, 2016
(#) world-s válasza RoliNyh hozzászólására (») Szept 27, 2016 /
 
Azt tudom, hogy mi a PWM.
És igen ad is.

De mint rögtön látod:
Valamelyik esetén tesznek valamilyen ellenállást a vezérlő lábra és az arduino közé, de van, hogy a vezérlő láb a a föld közé. És van hogy semmit.
És azt viszont már nem tudom hogy mitől függ, hogy szükséges -e.

Ugye ha van egy csomó ilyen IRLR 024 NPBF-m, lletve végül is most nézem van egy darab IRF 7313, amiben 2 MOSFET van (kár, hogy nem látok olyat amiben még több lenne és irtó kicsi helyet foglalna).

Így talán ha nem rosszul nézem az adattáblát (és tényleg 6.5A-ig terhelhető és ugyanazt tudja talán), akkor egy csomó helyet tudnék spórolni a IRF 7313-mal.

Tehát a kérdés, hogy mitől függ, hogy kell -e a vezérlés elé ellenállás?
Valamelyik adatától?
IRLR 024 és akkor lehet inkább IRF 7313-ben gondolkodom.
A hozzászólás módosítva: Szept 27, 2016
(#) kapu48 válasza world-s hozzászólására (») Szept 27, 2016 /
 
Ez a kérdés nem ide tartozik!

Az arduino-nak semmi köze a Te alap elektronikai tudásod, hiány pótlásához!

Légy szíves keres magadnak megfelelő fórumot!
Ne off-olj!
(#) sany hozzászólása Szept 27, 2016 /
 
Sziasztok!
Megint elakadtam egy forráskód lefordításánál.
Egy IR távirányító kódjainak lekérésénél. A neten találtam a következő forráskódot:

  1. #include <IRremote.h>
  2.  
  3. int RECV_PIN = 11;
  4. IRrecv irrecv(RECV_PIN);
  5. decode_results results;
  6.  
  7. void setup()
  8. {
  9.   Serial.begin(9600);
  10.   irrecv.enableIRIn(); // Start the receiver
  11. }
  12.  
  13. void loop() {
  14.   if (irrecv.decode(&results)) {
  15.     Serial.println(results.value, HEX);
  16.     irrecv.resume(); // Receive the next value
  17.   }
  18. }



Fordításnál ezt a hibát kapom:

C:\Program Files\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp:5:16: error: 'TKD2' was not declared in this scope
int RECV_PIN = TKD2; // the pin the IR receiver is connected to

Mi lehet a TDK2?
(#) vizor válasza sany hozzászólására (») Szept 27, 2016 /
 
Üdv. Hiba a library-ban, nincs sehol definiálva a TKD2 konstans értéke. Valahová be kell írnod a progi elejére, hogy:
#define TKD2 3
Ezzel például a 3-as pin lesz a TKD2.

De itt még nem fog megállni a problémák sora, kb. 1 éve ugyanebben a topicban kapu48 kolléga már végigmagyarázta a dolog megoldását. Innentől el is olvashatod. Jó pár hozzászólás.
A hozzászólás módosítva: Szept 27, 2016
(#) world-s válasza kapu48 hozzászólására (») Szept 27, 2016 /
 
Ok köszi.
Csak máskor meg, ha elhangzik, hogy arduino, akkor meg ide küldenek.
De akkor felteszem az alapban is.
A hozzászólás módosítva: Szept 27, 2016
(#) sany válasza vizor hozzászólására (») Szept 27, 2016 /
 
Köszi szépen! Sikerült, azt hittem nálam van a hiba megint .
(#) jeges hozzászólása Szept 27, 2016 /
 
Debounce efektus millis nélkül meg oldhat másképen is?
vagyis egy led egy nyomogomb meg nyomomásakor be kapcsolva marad még egyszer megnyomás után kikapcsol ?
millis szeretném kihagyni!
(#) zsolt58 válasza kapu48 hozzászólására (») Szept 27, 2016 /
 
Köszönöm.
Átírtam de ezt a hibaüzenetet dobja ki.
Ez miért van?
  1. Arduino: 1.6.11 (Windows 7), Alaplap:"Arduino/Genuino Uno"
  2.  
  3. In file included from C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM.h:46:0,
  4.  
  5.                  from C:\Users\H.Zsolt\Desktop\Tal_n_j__kett__pir_sms\Tal_n_j__kett__pir_sms.ino:35:
  6.  
  7. C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration
  8.  
  9.  typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};
  10.  
  11.                                                                                                                              ^
  12.  
  13. C:\Users\H.Zsolt\Desktop\Tal_n_j__kett__pir_sms\Tal_n_j__kett__pir_sms.ino: In function 'void loop()':
  14.  
  15. C:\Users\H.Zsolt\Desktop\Tal_n_j__kett__pir_sms\Tal_n_j__kett__pir_sms.ino:184:44: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  16.  
  17.       (sms.SendSMS( "+381611594988", "PIR1" ));
  18.  
  19.                                             ^
  20.  
  21. C:\Users\H.Zsolt\Desktop\Tal_n_j__kett__pir_sms\Tal_n_j__kett__pir_sms.ino:184:44: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  22.  
  23. C:\Users\H.Zsolt\Desktop\Tal_n_j__kett__pir_sms\Tal_n_j__kett__pir_sms.ino:187:44: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  24.  
  25.       (sms.SendSMS( "+381611594988", "PIR2" ));
  26.  
  27.                                             ^
  28.  
  29. C:\Users\H.Zsolt\Desktop\Tal_n_j__kett__pir_sms\Tal_n_j__kett__pir_sms.ino:187:44: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  30.  
  31. libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin): In function `GSM3SoftSerial::spaceAvailable()':
  32.  
  33. (.text+0x0): multiple definition of `__vector_3'
  34.  
  35. libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
  36.  
  37. libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin): In function `GSM3SoftSerial::spaceAvailable()':
  38.  
  39. (.text+0x0): multiple definition of `__vector_4'
  40.  
  41. libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
  42.  
  43. libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin): In function `GSM3SoftSerial::spaceAvailable()':
  44.  
  45. (.text+0x0): multiple definition of `__vector_5'
  46.  
  47. libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
  48.  
  49. collect2.exe: error: ld returned 1 exit status
  50.  
  51. exit status 1
  52. Error compiling for board Arduino/Genuino Uno.
  53.  
  54. This report would have more information with
  55. "Show verbose output during compilation"
  56. option enabled in File -> Preferences.


És itt a kijavított kód.

  1. /*
  2. * //////////////////////////////////////////////////
  3. * //making sense of the Parallax PIR sensor's output
  4. * //////////////////////////////////////////////////
  5. *
  6. * Switches a LED according to the state of the sensors output pin.
  7. * Determines the beginning and end of continuous motion sequences.
  8. *
  9. * @author: Kristian Gohlke / krigoo (_) gmail (_) com / http://krx.at
  10. * @date:   3. September 2006
  11. *
  12. * kr1 (cleft) 2006
  13. * released under a creative commons "Attribution-NonCommercial-ShareAlike 2.0" license
  14. *
  15. *
  16. * The Parallax PIR Sensor is an easy to use digital infrared motion sensor module.
  17. * (http://www.parallax.com/detail.asp?product_id=555-28027)
  18. *
  19. * The sensor's output pin goes to HIGH if motion is present.
  20. * However, even if motion is present it goes to LOW from time to time,
  21. * which might give the impression no motion is present.
  22. * This program deals with this issue by ignoring LOW-phases shorter than a given time,
  23. * assuming continuous motion is present during these phases.
  24. *  
  25. */
  26.  
  27. /////////////////////////////
  28. //VARS
  29. //the time we give the sensor to calibrate (10-60 secs according to the datasheet)
  30. #include "SIM900.h"
  31. #include <SoftwareSerial.h>
  32. #include "sms.h"
  33. SMSGSM sms;
  34. #include <GSM.h>
  35. boolean PIR1=false;
  36. boolean PIR2=false;
  37. int calibrationTime = 30;        
  38.  
  39. //the time when the sensor outputs a low impulse
  40. long unsigned int lowIn1;      
  41. long unsigned int lowIn2;            
  42.  
  43. //the amount of milliseconds the sensor has to be low
  44. //before we assume all motion has stopped
  45. long unsigned int pause = 100;  
  46.  
  47. boolean lockLow1 = true;
  48. boolean takeLowTime1;  
  49. boolean lockLow2 = true;
  50. boolean takeLowTime2;
  51.  
  52. int pirPin2 = 10;
  53. int pirPin1 = 3;    //the digital pin connected to the PIR sensor's output
  54. int ledPin = 7;
  55. int flag1=0;
  56. int flag2=0;
  57. int ctr=0;
  58.  
  59. /////////////////////////////
  60. //SETUP
  61. void setup(){
  62.  Serial.begin(9600);
  63.  pinMode(pirPin1, INPUT);
  64.  pinMode(pirPin2, INPUT);
  65.  pinMode(ledPin, OUTPUT);
  66.  digitalWrite(pirPin1, LOW);
  67.  digitalWrite(pirPin2, LOW);
  68.  //give the sensor some time to calibrate
  69.  Serial.print("calibrating sensor ");
  70.    for(int i = 0; i < calibrationTime; i++){
  71.      Serial.print(".");
  72.      delay(1000);
  73.      }
  74.    Serial.println(" done");
  75.    Serial.println("SENSOR ACTIVE");
  76.    delay(50);
  77.    
  78.    //Serial connection.
  79.   Serial.begin(9600);
  80.   Serial.println("GSM Shield testing.");
  81.  
  82.  
  83.  }
  84.  
  85. ////////////////////////////
  86. //LOOP
  87. void loop(){
  88.  static int relayVal = 0;
  89.  
  90.     if(digitalRead(pirPin1) == HIGH){
  91.     //the led visualizes the sensors output pin state
  92.       if(lockLow1){  
  93.         //makes sure we wait for a transition to LOW before any further output is made:
  94.         lockLow1 = false;  
  95.         Serial.println("");          
  96.         Serial.print(" Motion Detected PIR1 ");
  97.         delay(50);
  98.         flag1=1;
  99.         if(flag2==1)
  100.         {
  101.          ctr=ctr+1;
  102.          flag1=0;
  103.          flag2=0;
  104.          if(ctr<=0)
  105.                  digitalWrite(ledPin, LOW);
  106.                    if(ctr>0)
  107.                  digitalWrite(ledPin, HIGH);
  108.         }
  109.      
  110.         }        
  111.         takeLowTime1 = true;
  112.       }
  113. //*************8
  114.  
  115.     if(digitalRead(pirPin2) == HIGH){
  116.        //the led visualizes the sensors output pin state
  117.       if(lockLow2){  
  118.         //makes sure we wait for a transition to LOW before any further output is made:
  119.         lockLow2 = false;  
  120.         Serial.println("");        
  121.         Serial.print(" Motion Detected PIR2 ");
  122.           //Serial.println(flag1);
  123.          //Serial.println(flag2);
  124.         delay(50);
  125.          flag2=1;
  126.         if(flag1==1)
  127.         {
  128.          ctr=ctr-1;
  129.          flag1=0;
  130.          flag2=0;
  131.          if(ctr<=0)
  132.                  digitalWrite(ledPin, LOW);
  133.                    if(ctr>0)
  134.                  digitalWrite(ledPin, HIGH);
  135.         }
  136.      
  137.         }        
  138.         takeLowTime2 = true;
  139.       }
  140. //#####  
  141. //************
  142.  
  143.     if(digitalRead(pirPin1) == LOW){      
  144.       //digitalWrite(ledPin, LOW);  //the led visualizes the sensors output pin state
  145.  
  146.       if(takeLowTime1){
  147.        lowIn1 = millis();          //save the time of the transition from high to LOW
  148.        takeLowTime1 = false;       //make sure this is only done at the start of a LOW phase
  149.        }
  150.       //if the sensor is low for more than the given pause,
  151.       //we assume that no more motion is going to happen
  152.       if(!lockLow1 && millis() - lowIn1 > pause){  
  153.           //makes sure this block of code is only executed again after
  154.           //a new motion sequence has been detected
  155.           lockLow1 = true;                        
  156.           delay(50);
  157.           }
  158.       }
  159. //#####
  160. if(digitalRead(pirPin2) == LOW){      
  161.       //digitalWrite(ledPin, LOW);  //the led visualizes the sensors output pin state
  162.  
  163.       if(takeLowTime2){
  164.        lowIn2 = millis();          //save the time of the transition from high to LOW
  165.        takeLowTime2 = false;       //make sure this is only done at the start of a LOW phase
  166.        }
  167.       //if the sensor is low for more than the given pause,
  168.       //we assume that no more motion is going to happen
  169.       if(!lockLow2 && millis() - lowIn2 > pause){  
  170.           //makes sure this block of code is only executed again after
  171.           //a new motion sequence has been detected
  172.           lockLow2 = true;                      
  173.           delay(50);
  174.           }
  175.       };
  176. //#####
  177.    if (Serial.println("\nstatus= Motion Detected PIR1 "))
  178.     {PIR1 == true;}
  179.   else if (Serial.println("\nstatus= Motion Detected PIR2 "))
  180.     {PIR2 == true;}
  181.  
  182.   if(PIR1 == true){
  183.      (sms.SendSMS( "+381611594988", "PIR1" ));
  184.       Serial.println("\nSMS sent OK 1");
  185.   }else if (PIR2 == true){
  186.      (sms.SendSMS( "+381611594988", "PIR2" ));
  187.       Serial.println("\nSMS sent OK 2");
  188.   };
  189.  
  190. };
(#) mateatek válasza zsolt58 hozzászólására (») Szept 28, 2016 / 1
 
A 105, és a 107 sorban is szerepel egy-egy if utasítás, ahol nincsen kapcsos zárójelbe téve az utasítás, amit tennie kellene. Ugyanígy a 132 és 134 sor is.
(#) zsolt58 válasza mateatek hozzászólására (») Szept 28, 2016 /
 
Köszi.
Kijavítottam de még mindig valami nem jó neki, mi lehet az?
Ez a hibakód:

  1. Arduino: 1.6.11 (Windows 7), Alaplap:"Arduino/Genuino Uno"
  2.  
  3. In file included from C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM.h:46:0,
  4.  
  5.                  from C:\Users\H.Zsolt\Desktop\Tal_n_j__kett__pir_sms\Tal_n_j__kett__pir_sms.ino:35:
  6.  
  7. C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration
  8.  
  9.  typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};
  10.  
  11.                                                                                                                              ^
  12.  
  13. C:\Users\H.Zsolt\Desktop\Tal_n_j__kett__pir_sms\Tal_n_j__kett__pir_sms.ino: In function 'void loop()':
  14.  
  15. C:\Users\H.Zsolt\Desktop\Tal_n_j__kett__pir_sms\Tal_n_j__kett__pir_sms.ino:188:44: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  16.  
  17.       (sms.SendSMS( "+381611594988", "PIR1" ));
  18.  
  19.                                             ^
  20.  
  21. C:\Users\H.Zsolt\Desktop\Tal_n_j__kett__pir_sms\Tal_n_j__kett__pir_sms.ino:188:44: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  22.  
  23. C:\Users\H.Zsolt\Desktop\Tal_n_j__kett__pir_sms\Tal_n_j__kett__pir_sms.ino:191:44: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  24.  
  25.       (sms.SendSMS( "+381611594988", "PIR2" ));
  26.  
  27.                                             ^
  28.  
  29. C:\Users\H.Zsolt\Desktop\Tal_n_j__kett__pir_sms\Tal_n_j__kett__pir_sms.ino:191:44: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  30.  
  31. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3MobileMockupProvider.cpp: In constructor 'GSM3MobileMockupProvider::GSM3MobileMockupProvider()':
  32.  
  33. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3MobileMockupProvider.cpp:44:12: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  34.  
  35.   msgExample="Hello#World";
  36.  
  37.             ^
  38.  
  39. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3MobileMockupProvider.cpp: In member function 'int GSM3MobileMockupProvider::connectTCPServer(int, char*, int*)':
  40.  
  41. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3MobileMockupProvider.cpp:183:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  42.  
  43.    strcpy("192.168.1.1", localIP);
  44.  
  45.                                 ^
  46.  
  47. In file included from C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:34:0:
  48.  
  49. C:\Program Files (x86)\Arduino\libraries\GSM\src/GSM3ShieldV1BandManagement.h:49:125: warning: 'typedef' was ignored in this declaration
  50.  
  51.  typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};
  52.  
  53.                                                                                                                              ^
  54.  
  55. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp: In constructor 'GSM3ShieldV1BandManagement::GSM3ShieldV1BandManagement(bool)':
  56.  
  57. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:38:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  58.  
  59.   quectelStrings[UNDEFINED]="";
  60.  
  61.                            ^
  62.  
  63. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:39:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  64.  
  65.   quectelStrings[EGSM_MODE]="\"EGSM_MODE\"";
  66.  
  67.                            ^
  68.  
  69. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:40:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  70.  
  71.   quectelStrings[DCS_MODE]="\"DCS_MODE\"";
  72.  
  73.                           ^
  74.  
  75. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:41:26: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  76.  
  77.   quectelStrings[PCS_MODE]="\"PCS_MODE\"";
  78.  
  79.                           ^
  80.  
  81. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:42:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  82.  
  83.   quectelStrings[EGSM_DCS_MODE]="\"EGSM_DCS_MODE\"";
  84.  
  85.                                ^
  86.  
  87. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:43:33: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  88.  
  89.   quectelStrings[GSM850_PCS_MODE]="\"GSM850_PCS_MODE\"";
  90.  
  91.                                  ^
  92.  
  93. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1BandManagement.cpp:44:42: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  94.  
  95.   quectelStrings[GSM850_EGSM_DCS_PCS_MODE]="\"GSM850_EGSM_DCS_PCS_MODE\"";
  96.  
  97.                                           ^
  98.  
  99. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1ModemCore.cpp:39:14: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  100.  
  101.  char* __ok__="OK";
  102.  
  103.               ^
  104.  
  105. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1ModemVerification.cpp: In member function 'String GSM3ShieldV1ModemVerification::getIMEI()':
  106.  
  107. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1ModemVerification.cpp:64:20: warning: passing NULL to non-pointer argument 1 of 'String::String(int, unsigned char)' [-Wconversion-null]
  108.  
  109.   String number(NULL);
  110.  
  111.                     ^
  112.  
  113. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1SMSProvider.cpp: In member function 'void GSM3ShieldV1SMSProvider::beginSMSContinue()':
  114.  
  115. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1SMSProvider.cpp:68:57: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
  116.  
  117.    if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, ">"))
  118.  
  119.                                                          ^
  120.  
  121. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1ScanNetworks.cpp: In member function 'String GSM3ShieldV1ScanNetworks::getCurrentCarrier()':
  122.  
  123. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1ScanNetworks.cpp:66:21: warning: passing NULL to non-pointer argument 1 of 'String::String(int, unsigned char)' [-Wconversion-null]
  124.  
  125.    return String(NULL);
  126.  
  127.                      ^
  128.  
  129. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1ScanNetworks.cpp: In member function 'String GSM3ShieldV1ScanNetworks::getSignalStrength()':
  130.  
  131. C:\Program Files (x86)\Arduino\libraries\GSM\src\GSM3ShieldV1ScanNetworks.cpp:85:21: warning: passing NULL to non-pointer argument 1 of 'String::String(int, unsigned char)' [-Wconversion-null]
  132.  
  133.    return String(NULL);
  134.  
  135.                      ^
  136.  
  137. libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin): In function `GSM3SoftSerial::spaceAvailable()':
  138.  
  139. (.text+0x0): multiple definition of `__vector_3'
  140.  
  141. libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
  142.  
  143. libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin): In function `GSM3SoftSerial::spaceAvailable()':
  144.  
  145. (.text+0x0): multiple definition of `__vector_4'
  146.  
  147. libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
  148.  
  149. libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin): In function `GSM3SoftSerial::spaceAvailable()':
  150.  
  151. (.text+0x0): multiple definition of `__vector_5'
  152.  
  153. libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
  154.  
  155. collect2.exe: error: ld returned 1 exit status
  156.  
  157. exit status 1
  158. Error compiling for board Arduino/Genuino Uno.
  159.  
  160. This report would have more information with
  161. "Show verbose output during compilation"
  162. option enabled in File -> Preferences.


Ez pedig a kijavított programkód:

  1. /*
  2. * //////////////////////////////////////////////////
  3. * //making sense of the Parallax PIR sensor's output
  4. * //////////////////////////////////////////////////
  5. *
  6. * Switches a LED according to the state of the sensors output pin.
  7. * Determines the beginning and end of continuous motion sequences.
  8. *
  9. * @author: Kristian Gohlke / krigoo (_) gmail (_) com / http://krx.at
  10. * @date:   3. September 2006
  11. *
  12. * kr1 (cleft) 2006
  13. * released under a creative commons "Attribution-NonCommercial-ShareAlike 2.0" license
  14. *
  15. *
  16. * The Parallax PIR Sensor is an easy to use digital infrared motion sensor module.
  17. * (http://www.parallax.com/detail.asp?product_id=555-28027)
  18. *
  19. * The sensor's output pin goes to HIGH if motion is present.
  20. * However, even if motion is present it goes to LOW from time to time,
  21. * which might give the impression no motion is present.
  22. * This program deals with this issue by ignoring LOW-phases shorter than a given time,
  23. * assuming continuous motion is present during these phases.
  24. *
  25. */
  26.  
  27. /////////////////////////////
  28. //VARS
  29. //the time we give the sensor to calibrate (10-60 secs according to the datasheet)
  30. #include "SIM900.h"
  31. #include <SoftwareSerial.h>
  32. #include "sms.h"
  33. SMSGSM sms;
  34. #include <GSM.h>
  35. boolean PIR1=false;
  36. boolean PIR2=false;
  37. int calibrationTime = 30;      
  38.  
  39. //the time when the sensor outputs a low impulse
  40. long unsigned int lowIn1;    
  41. long unsigned int lowIn2;          
  42.  
  43. //the amount of milliseconds the sensor has to be low
  44. //before we assume all motion has stopped
  45. long unsigned int pause = 100;
  46.  
  47. boolean lockLow1 = true;
  48. boolean takeLowTime1;
  49. boolean lockLow2 = true;
  50. boolean takeLowTime2;
  51.  
  52. int pirPin2 = 10;
  53. int pirPin1 = 3;    //the digital pin connected to the PIR sensor's output
  54. int ledPin = 7;
  55. int flag1=0;
  56. int flag2=0;
  57. int ctr=0;
  58.  
  59. /////////////////////////////
  60. //SETUP
  61. void setup(){
  62.  Serial.begin(9600);
  63.  pinMode(pirPin1, INPUT);
  64.  pinMode(pirPin2, INPUT);
  65.  pinMode(ledPin, OUTPUT);
  66.  digitalWrite(pirPin1, LOW);
  67.  digitalWrite(pirPin2, LOW);
  68.  //give the sensor some time to calibrate
  69.  Serial.print("calibrating sensor ");
  70.    for(int i = 0; i < calibrationTime; i++){
  71.      Serial.print(".");
  72.      delay(1000);
  73.      }
  74.    Serial.println(" done");
  75.    Serial.println("SENSOR ACTIVE");
  76.    delay(50);
  77.    
  78.    //Serial connection.
  79.   Serial.begin(9600);
  80.   Serial.println("GSM Shield testing.");
  81.  
  82.  
  83.  }
  84.  
  85. ////////////////////////////
  86. //LOOP
  87. void loop(){
  88.  static int relayVal = 0;
  89.  
  90.     if(digitalRead(pirPin1) == HIGH){
  91.     //the led visualizes the sensors output pin state
  92.       if(lockLow1){
  93.         //makes sure we wait for a transition to LOW before any further output is made:
  94.         lockLow1 = false;  
  95.         Serial.println("");        
  96.         Serial.print(" Motion Detected PIR1 ");
  97.         delay(50);
  98.         flag1=1;
  99.         if(flag2==1)
  100.         {
  101.          ctr=ctr+1;
  102.          flag1=0;
  103.          flag2=0;
  104.          if(ctr<=0)
  105.                  {digitalWrite(ledPin, LOW);
  106.                  }
  107.                    if(ctr>0){
  108.                  digitalWrite(ledPin, HIGH);
  109.                  }
  110.         }
  111.      
  112.         }        
  113.         takeLowTime1 = true;
  114.       }
  115. //*************8
  116.  
  117.     if(digitalRead(pirPin2) == HIGH){
  118.        //the led visualizes the sensors output pin state
  119.       if(lockLow2){
  120.         //makes sure we wait for a transition to LOW before any further output is made:
  121.         lockLow2 = false;  
  122.         Serial.println("");        
  123.         Serial.print(" Motion Detected PIR2 ");
  124.           //Serial.println(flag1);
  125.          //Serial.println(flag2);
  126.         delay(50);
  127.          flag2=1;
  128.         if(flag1==1)
  129.         {
  130.          ctr=ctr-1;
  131.          flag1=0;
  132.          flag2=0;
  133.          if(ctr<=0)
  134.                  {digitalWrite(ledPin, LOW);
  135.                  }
  136.                    if(ctr>0)
  137.                  {digitalWrite(ledPin, HIGH);
  138.                  }
  139.         }
  140.      
  141.         }        
  142.         takeLowTime2 = true;
  143.       }
  144. //#####  
  145. //************
  146.  
  147.     if(digitalRead(pirPin1) == LOW){      
  148.       //digitalWrite(ledPin, LOW);  //the led visualizes the sensors output pin state
  149.  
  150.       if(takeLowTime1){
  151.        lowIn1 = millis();          //save the time of the transition from high to LOW
  152.        takeLowTime1 = false;       //make sure this is only done at the start of a LOW phase
  153.        }
  154.       //if the sensor is low for more than the given pause,
  155.       //we assume that no more motion is going to happen
  156.       if(!lockLow1 && millis() - lowIn1 > pause){
  157.           //makes sure this block of code is only executed again after
  158.           //a new motion sequence has been detected
  159.           lockLow1 = true;                      
  160.           delay(50);
  161.           }
  162.       }
  163. //#####
  164. if(digitalRead(pirPin2) == LOW){      
  165.       //digitalWrite(ledPin, LOW);  //the led visualizes the sensors output pin state
  166.  
  167.       if(takeLowTime2){
  168.        lowIn2 = millis();          //save the time of the transition from high to LOW
  169.        takeLowTime2 = false;       //make sure this is only done at the start of a LOW phase
  170.        }
  171.       //if the sensor is low for more than the given pause,
  172.       //we assume that no more motion is going to happen
  173.       if(!lockLow2 && millis() - lowIn2 > pause){
  174.           //makes sure this block of code is only executed again after
  175.           //a new motion sequence has been detected
  176.           lockLow2 = true;                    
  177.           delay(50);
  178.           }
  179.       };
  180. //#####
  181.    if (Serial.println("\nstatus= Motion Detected PIR1 "))
  182.     {PIR1 == true;}
  183.   else if (Serial.println("\nstatus= Motion Detected PIR2 "))
  184.     {PIR2 == true;}
  185.  
  186.   if(PIR1 == true){
  187.      (sms.SendSMS( "+381611594988", "PIR1" ));
  188.       Serial.println("\nSMS sent OK 1");
  189.   }else if (PIR2 == true){
  190.      (sms.SendSMS( "+381611594988", "PIR2" ));
  191.       Serial.println("\nSMS sent OK 2");
  192.   };
  193.  
  194. };


Üdv.
(#) kapu48 válasza zsolt58 hozzászólására (») Szept 28, 2016 / 1
 
Remélem, ékezetes betűket nem használsz a névadásnál? Az elérési útban mi az a sok aláhúzás jel?
Kb. 6 hozzászólással ezelőtt vizor felhívta a figyelmet hasonló hibakeresésre, olvas vissza!
A más hibájából is lehet tanulni!

Már írtam, hogy a 182, 184 soroknak abban a formában semmi értelmük nincsen!
Javítani kellene!

Mivel mi nem tudunk elnavigálni a Te gépeden levő jelzett hibához:
C:\Program Files(x86)\Arduino\libraries\GSM\src/GSM3ShieldV1BandManagement.h :49. sor, 125. karakterhez!
Így fogalmunk sincs, mi lehet a hiba?
A hozzászólás módosítva: Szept 28, 2016
(#) zsolt58 válasza kapu48 hozzászólására (») Szept 28, 2016 /
 
Kijavítottam.
De most se jó.
Miért?
Hibakód:

  1. Arduino: 1.6.11 (Windows 7), Alaplap:"Arduino/Genuino Uno"
  2.  
  3. libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin): In function `GSM3SoftSerial::spaceAvailable()':
  4.  
  5. (.text+0x0): multiple definition of `__vector_3'
  6.  
  7. libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
  8.  
  9. libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin): In function `GSM3SoftSerial::spaceAvailable()':
  10.  
  11. (.text+0x0): multiple definition of `__vector_4'
  12.  
  13. libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
  14.  
  15. libraries\GSM\GSM3SoftSerial.cpp.o (symbol from plugin): In function `GSM3SoftSerial::spaceAvailable()':
  16.  
  17. (.text+0x0): multiple definition of `__vector_5'
  18.  
  19. libraries\SoftwareSerial\SoftwareSerial.cpp.o (symbol from plugin):(.text+0x0): first defined here
  20.  
  21. C:\Users\H701E~1.ZSO\AppData\Local\Temp\ccup0Sri.ltrans1.ltrans.o: In function `main':
  22.  
  23. ccup0Sri.ltrans1.o.text.startup+0x2de): undefined reference to `SMSGSM::SendSMS(char*, char*)'
  24.  
  25. ccup0Sri.ltrans1.o:(.text.startup+0x300): undefined reference to `SMSGSM::SendSMS(char*, char*)'
  26.  
  27. collect2.exe: error: ld returned 1 exit status
  28.  
  29. exit status 1
  30. Error compiling for board Arduino/Genuino Uno.
  31.  
  32. This report would have more information with
  33. "Show verbose output during compilation"
  34. option enabled in File -> Preferences.


Programkód:

  1. /*
  2. * //////////////////////////////////////////////////
  3. * //making sense of the Parallax PIR sensor's output
  4. * //////////////////////////////////////////////////
  5. *
  6. * Switches a LED according to the state of the sensors output pin.
  7. * Determines the beginning and end of continuous motion sequences.
  8. *
  9. * @author: Kristian Gohlke / krigoo (_) gmail (_) com / http://krx.at
  10. * @date:   3. September 2006
  11. *
  12. * kr1 (cleft) 2006
  13. * released under a creative commons "Attribution-NonCommercial-ShareAlike 2.0" license
  14. *
  15. *
  16. * The Parallax PIR Sensor is an easy to use digital infrared motion sensor module.
  17. * (http://www.parallax.com/detail.asp?product_id=555-28027)
  18. *
  19. * The sensor's output pin goes to HIGH if motion is present.
  20. * However, even if motion is present it goes to LOW from time to time,
  21. * which might give the impression no motion is present.
  22. * This program deals with this issue by ignoring LOW-phases shorter than a given time,
  23. * assuming continuous motion is present during these phases.
  24. *
  25. */
  26.  
  27. /////////////////////////////
  28. //VARS
  29. //the time we give the sensor to calibrate (10-60 secs according to the datasheet)
  30. #include "SIM900.h"
  31. #include <SoftwareSerial.h>
  32. #include "sms.h"
  33. SMSGSM sms;
  34. #include <GSM.h>
  35. boolean PIR1=false;
  36. boolean PIR2=false;
  37. int calibrationTime = 30;      
  38.  
  39. //the time when the sensor outputs a low impulse
  40. long unsigned int lowIn1;    
  41. long unsigned int lowIn2;          
  42.  
  43. //the amount of milliseconds the sensor has to be low
  44. //before we assume all motion has stopped
  45. long unsigned int pause = 100;
  46.  
  47. boolean lockLow1 = true;
  48. boolean takeLowTime1;
  49. boolean lockLow2 = true;
  50. boolean takeLowTime2;
  51.  
  52. int pirPin2 = 10;
  53. int pirPin1 = 3;    //the digital pin connected to the PIR sensor's output
  54. int ledPin = 7;
  55. int flag1=0;
  56. int flag2=0;
  57. int ctr=0;
  58.  
  59. /////////////////////////////
  60. //SETUP
  61. void setup(){
  62.  Serial.begin(9600);
  63.  pinMode(pirPin1, INPUT);
  64.  pinMode(pirPin2, INPUT);
  65.  pinMode(ledPin, OUTPUT);
  66.  digitalWrite(pirPin1, LOW);
  67.  digitalWrite(pirPin2, LOW);
  68.  //give the sensor some time to calibrate
  69.  Serial.print("calibrating sensor ");
  70.    for(int i = 0; i < calibrationTime; i++){
  71.      Serial.print(".");
  72.      delay(1000);
  73.      }
  74.    Serial.println(" done");
  75.    Serial.println("SENSOR ACTIVE");
  76.    delay(50);
  77.    
  78.    //Serial connection.
  79.   Serial.begin(9600);
  80.   Serial.println("GSM Shield testing.");
  81.  
  82.  
  83.  }
  84.  
  85. ////////////////////////////
  86. //LOOP
  87. void loop(){
  88.  static int relayVal = 0;
  89.  
  90.     if(digitalRead(pirPin1) == HIGH){
  91.     //the led visualizes the sensors output pin state
  92.       if(lockLow1){
  93.         //makes sure we wait for a transition to LOW before any further output is made:
  94.         lockLow1 = false;  
  95.         Serial.println("");        
  96.         Serial.print(" 1 ");
  97.         delay(50);
  98.         flag1=1;
  99.         if(flag2==1)
  100.         {
  101.          ctr=ctr+1;
  102.          flag1=0;
  103.          flag2=0;
  104.          if(ctr<=0)
  105.                  {digitalWrite(ledPin, LOW);
  106.                  }
  107.                    if(ctr>0){
  108.                  digitalWrite(ledPin, HIGH);
  109.                  }
  110.         }
  111.      
  112.         }        
  113.         takeLowTime1 = true;
  114.       }
  115. //*************8
  116.  
  117.     if(digitalRead(pirPin2) == HIGH){
  118.        //the led visualizes the sensors output pin state
  119.       if(lockLow2){
  120.         //makes sure we wait for a transition to LOW before any further output is made:
  121.         lockLow2 = false;  
  122.         Serial.println("");        
  123.         Serial.print(" 3 ");
  124.           //Serial.println(flag1);
  125.          //Serial.println(flag2);
  126.         delay(50);
  127.          flag2=1;
  128.         if(flag1==1)
  129.         {
  130.          ctr=ctr-1;
  131.          flag1=0;
  132.          flag2=0;
  133.          if(ctr<=0)
  134.                  {digitalWrite(ledPin, LOW);
  135.                  }
  136.                    if(ctr>0)
  137.                  {digitalWrite(ledPin, HIGH);
  138.                  }
  139.         }
  140.      
  141.         }        
  142.         takeLowTime2 = true;
  143.       }
  144. //#####  
  145. //************
  146.  
  147.     if(digitalRead(pirPin1) == LOW){      
  148.       //digitalWrite(ledPin, LOW);  //the led visualizes the sensors output pin state
  149.  
  150.       if(takeLowTime1){
  151.        lowIn1 = millis();          //save the time of the transition from high to LOW
  152.        takeLowTime1 = false;       //make sure this is only done at the start of a LOW phase
  153.        }
  154.       //if the sensor is low for more than the given pause,
  155.       //we assume that no more motion is going to happen
  156.       if(!lockLow1 && millis() - lowIn1 > pause){
  157.           //makes sure this block of code is only executed again after
  158.           //a new motion sequence has been detected
  159.           lockLow1 = true;                      
  160.           delay(50);
  161.           }
  162.       }
  163. //#####
  164. if(digitalRead(pirPin2) == LOW){      
  165.       //digitalWrite(ledPin, LOW);  //the led visualizes the sensors output pin state
  166.  
  167.       if(takeLowTime2){
  168.        lowIn2 = millis();          //save the time of the transition from high to LOW
  169.        takeLowTime2 = false;       //make sure this is only done at the start of a LOW phase
  170.        }
  171.       //if the sensor is low for more than the given pause,
  172.       //we assume that no more motion is going to happen
  173.       if(!lockLow2 && millis() - lowIn2 > pause){
  174.           //makes sure this block of code is only executed again after
  175.           //a new motion sequence has been detected
  176.           lockLow2 = true;                    
  177.           delay(50);
  178.           }
  179.       };
  180. //#####
  181.    if (Serial.available() < 2){
  182.      (sms.SendSMS( "+381611594988", "PIR1" ));
  183.       Serial.println("\nSMS sent OK 1");
  184.   } else if (Serial.available() > 2){
  185.      (sms.SendSMS( "+381611594988", "PIR2" ));
  186.       Serial.println("\nSMS sent OK 2");
  187.   };
  188. };
A hozzászólás módosítva: Szept 28, 2016
(#) vizor válasza zsolt58 hozzászólására (») Szept 28, 2016 / 1
 
Ha a library-ban ennyi hiba jön ki, akkor el kell gondolkodni a fordítóprogram verzióváltásán. Nálam az Arduino IDE 1.6.3. stabilan működik. Belinkelhetnéd, hogy honnan töltötted le a library-kat amiket használsz, ha nem a beépítetteket, hogy kipróbálhassuk.
(#) kapu48 válasza zsolt58 hozzászólására (») Szept 28, 2016 / 1
 
Igazán el olvashatnád a hibajelzést, mielőtt ide másolod!

Hiszen írja, hogy 3 helyen is van definiálva a : …::spaceAvailable() függvény!
És ennek a megszüntetését már kitárgyaltuk az előzőleg említett helyeken!
(#) zsolt58 válasza kapu48 hozzászólására (») Szept 28, 2016 /
 
De a mi az a spaceAvailable()
Nem tudom azt hol kell megoldani.
itt vannak a könyvtárak:
Következő: »»   265 / 864
Bejelentkezés

Belépés

Hirdetés
XDT.hu
Az oldalon sütiket használunk a helyes működéshez. Bővebb információt az adatvédelmi szabályzatban olvashatsz. Megértettem