Sloeber / arduino-eclipse-plugin

A plugin to make programming the arduino in eclipse easy
https://eclipse.baeyens.it/
419 stars 131 forks source link

set di istruzioni nn risucisto #286

Closed jkwatt closed 9 years ago

jkwatt commented 9 years ago

Description Resource Path Location Type set di istruzioni per l'obiettivo "arduino/WInterrupts.c.o" non riuscito subdir.mk /cancello_linux/Release/arduino/core line 175 C/C++ Problem

this is my code:

include

RCSwitch mySwitch = RCSwitch();

define interruptAntenna 0 // pin 2 SERVIRà PER RICEVERE IL SEGNALE DALL'ANTENNA RF

define pinL1 3 // DO USCITA CONTROLLO LAMPADA

define pinK1 4 // DIN INGRESSO CONTATTO CHIAVE

define pinMT1R 5 // PWM OUT USCITA PWM MOTORE 1 RIGHT

define pinMT1L 6 // PWM OUT PWM MOTORE 1 LEFT

define pinENR 7 // DO ENABLE PWM ROTAZIONE RIGHT

define pinENL 8 // DO ENABLE PWM ROTAZIONE LEFT

define pinMT2R 9 // PWM OUT USCITA PWM MOTORE 1 RIGHT

define pinMT2L 10 // PWM OUT PWM MOTORE 1 LEFT

define pinFT2 11 // DIN INGRESSO FOTOCELLULA 2 QUELLA LONTANA DAL CANCELLO

define pinSW1A 12 // DIN SWITCH SENSORE FINE CORSA 1 POSIZIONE APERTO

define pinSW1C 13 // DIN SWITCH SENSORE FINE CORSA 1 POSIZIONE CHIUSO

define pinSW2A A0 // DIN SWITCH SENSORE FINE CORSA 2 POSIZIONE APERTO

define pinSW2C A1 // DIN SWITCH SENSORE FINE CORSA 2 POSIZIONE CHIUSO

define pinAMP1 A2 // AIN SENSORE CORRENTE MOTORE 1 (UTILIZZATO PER DETERMINARE EVENTUALI OSTACOLI O PROTEZIONE CORRENTE)

define pinAMP2 A3 // AIN SENSORE CORRENTE MOTORE 2 (UTILIZZATO PER DETERMINARE EVENTUALI OSTACOLI O PROTEZIONE CORRENTE)

define pinFT1 A5 // DIN INGRESSO ANALOGICO CONFIGURATO COME DIGITALE PER PRENDERE LO STATO DELLA SECONDA FOTOCELLULA QUELLA IN LINEA NEL CANCELLO CHE MI DA L'ATTRAVERSAMENTO

int keycode =5592332;

boolean ultimaMarcia = false; // assumiamo FALSE = chiudi - TRUE = apri

boolean Fotocellule=false; //partiamo con valore false significa che le fotocellule sono sgombre boolean Alimentazione; boolean muovi = false; boolean ScambioMarcia=false;

unsigned long T;

int deltaT = 5000; // tempo di marcia del cancello/serranda per apertura/chiusura (da scegliersi in base alle proprie situazioni)

int RPWM1=0; //INIZIALIZZO TUTTI I SEGNALI PWM A 0 int LPWM11=0; int RPWM2=0; int LPWM12=0;

int Start=0; // valori per regolare il pwm Start= rampa di partenza RegimeMax=valore a regime RegimeMin=valore di velocità ridotta int RegimeMax=0; int RegimeMin=0;

int correnteMT1=0; int correnteMT2=0; int CorrenteLimite=0 ; // valore analogico limite per la corrente di assorbimento dei motori in vista di un ostacolo da valutare bool CorrenteAllarme=false;

void setup()

{

Serial.begin(9600); //inizializzo la seriale

pinMode(pinL1, OUTPUT); // configurazione pin pinMode(pinK1, INPUT);

pinMode(pinMT1R, OUTPUT); pinMode(pinMT1L, OUTPUT); pinMode(pinENR, OUTPUT); pinMode(pinENL, OUTPUT); pinMode(pinMT2R, OUTPUT); pinMode(pinMT2L, OUTPUT);

pinMode(pinFT2, INPUT);

pinMode(pinSW1A, INPUT); pinMode(pinSW1C, INPUT); pinMode(pinSW2A, INPUT); pinMode(pinSW2C, INPUT);

// NN è NECESSARIO SETTARE COME INGRESSI QUELLI DOVE FARO LE LETTURE ANALOGICHE BASTERA DARE IL COMANDO ANALOGUE READ

pinMode(pinFT1, INPUT);

mySwitch.enableReceive(interruptAntenna);

}

void loop()

{

// se stiamo eseguendo la marcia "chiudi" o "apri" // e viene rilevato un ostacolo dalle fotocellule fermo tutto

if ( digitalRead(pinFT1)|| digitalRead(pinFT2)) Fotocellule=HIGH; // aggiorno variabile presenza ostacoli sulle fotocellule ini base allo stato del sistema
else Fotocellule=LOW;

if ( (digitalRead(pinAMP1)>CorrenteLimite)|| (digitalRead(pinAMP1)>CorrenteLimite)) CorrenteAllarme=HIGH; // aggiorno variabile corrente e confronto per vedere una presenza ostacolo else CorrenteAllarme=LOW;

// aggiorno il bit Alimentazione che mi indica se ho abilitate le alimentazzioni dei motori del cancello
Alimentazione = (digitalRead(pinENR)||digitalRead(pinENR));

// se sono abilitato a muovere e ho presenza fotocellule disabilito muovi e di conseguenza gli enable a muovere pinENR e pinENL if ( Alimentazione && muovi && (Fotocellule||CorrenteAllarme) ) muovi = false;
if (!muovi){
digitalWrite(pinENR,LOW); digitalWrite(pinENL,LOW); }

// se ho ricevuto un segnale dal telecomando o dal pulsante/contatto chiave

if ( segnale() || digitalRead(pinK1) == HIGH ){

                                           if ( Alimentazione ){

                                                                 digitalWrite(pinENR,LOW);
                                                                 digitalWrite(pinENL,LOW);
                                                                 digitalWrite(Alimentazione, LOW);
                                                                 muovi = false;
                                                                 ultimaMarcia = !ultimaMarcia;  

                                                                }
                                          else{                 // se il cancello è gia fermo  setto il verso di marcia opposto al precedente.

                                                                if ( ultimaMarcia ) ScambioMarcia = false; // chiudi

                                                                else ScambioMarcia = true; // apri

                                                                muovi = true;

                                                                T = millis();

                                                                }

                                            }

// faccio partire la marcia finché non scade il tempo di marcia prestabilito // oppure qualcuno o qualcosa bloccano la marcia

if ( muovi && (millis() - T) < deltaT ){ Alimentazione = true ; //faccio partire la marcia prestabilita //gestione motori mia if(ScambioMarcia){ // abilito l'alimentazione nel senso di rotazione di apertura
Serial.println("pinENR ASSUMO IL VERSO DESTRO COME ROTAZIONE DI APERTURA");
digitalWrite(pinENR,HIGH); // pongo come condizione che la ROTAZIONE DESTRA SIA QUELLA PER CUI SI APRE IL CANCELLO (le connesioni dei pointi h sono invertite una rispetto all'altra) digitalWrite(pinENL,LOW);
delay(1000);

                                                        if(!pinSW1A){                                           //apro MT1 SE NN è GIA APERTO
                                                                      //creo la rampa di salita per il motore
                                                                      //***** inserire temporizzatore*****
                                                                       for(int i=0;i<Start;i++){                          
                                                                       analogWrite(pinMT1R,i);
                                                                                                                             }

                                                                      //stabilisco il funzionamento a regime max
                                                                     //***** inserire temporizzatore*****
                                                                       analogWrite(pinMT1R,RegimeMax);

                                                                      // rampa di discesa 
                                                                      for(int i=RegimeMax;i>RegimeMin;i--){
                                                                      analogWrite(pinMT1R,i);

                                                                     }

                                                                      // RegimeMin
                                                                      //***** inserire temporizzatore*****
                                                                      analogWrite(pinMT1R,RegimeMin);
                                                                      if(digitalRead(pinSW1A)) analogWrite(pinMT1R,0);// AZZERO L'USCITA PWM DEL MOTORE MT1

                                                        }
                                                        if(!pinSW2A){                                           //APRO MT2 SE NN è GIA APERTO

                                                                      //creo la rampa di salita per il motore
                                                                      //***** inserire temporizzatore*****
                                                                       delay (2000);// temportizzatore anticipo anta sinistra
                                                                       for(int i=0;i<Start;i++){                          
                                                                       analogWrite(pinMT2R,i);

                                                                      }

                                                                      //stabilisco il funzionamento a regime max
                                                                     //***** inserire temporizzatore*****
                                                                       analogWrite(pinMT2R,RegimeMax);

                                                                      // rampa di discesa 
                                                                      for(int i=RegimeMax;i>RegimeMin;i--){
                                                                      analogWrite(pinMT2R,i);

                                                                     }

                                                                      // RegimeMin
                                                                      //***** inserire temporizzatore*****
                                                                      analogWrite(pinMT2R,RegimeMin);
                                                                      if(digitalRead(pinSW2A)) analogWrite(pinMT2R,0);// AZZERO L'USCITA PWM DEL MOTORE MT2

                                                        }

                                      Serial.println("ENR LOW");
                                      //qui va la routine che chiude il cancello

                                      if(digitalRead(pinSW2A)&&digitalRead(pinSW1A))digitalWrite(pinENR,LOW); // SE HO ENTRAMBI ISENSORI DI POSIZIONE APERTO ALLORA RESETTO L'ABILITAZIONE

                                      delay(500);
                                      }
                                      else{
                               // abilito l'alimentazione nel senso di rotazione di apertura                                 
                              Serial.println("pinENL ASSUMO IL VERSO SINISTRO COME ROTAZIONE DI CHIUSURA");      
                              digitalWrite(pinENR,LOW);    
                              digitalWrite(pinENL,HIGH); // pongo come condizione che la ROTAZIONE SINITRA SIA QUELLA PER CUI SI CHIUDE IL CANCELLO (le connesioni dei pointi h sono invertite una rispetto all'altra)   
                              delay(1000);

                                                        if(!pinSW1C){                                           //CHIUDO MT1 SE NN è GIA CHIUSO
                                                                      //creo la rampa di salita per il motore
                                                                      //***** inserire temporizzatore*****

                                                                       delay (2000);                            // temporizzatore anticipo anta  MT1
                                                                       for(int i=0;i<Start;i++){                          
                                                                       analogWrite(pinMT1L,i);

                                                                      }

                                                                      //stabilisco il funzionamento a regime max
                                                                     //***** inserire temporizzatore*****
                                                                       analogWrite(pinMT1L,RegimeMax);

                                                                      // rampa di discesa 
                                                                      for(int i=RegimeMax;i>RegimeMin;i--){
                                                                      analogWrite(pinMT1L,i);

                                                                     }

                                                                      // RegimeMin
                                                                      //***** inserire temporizzatore*****
                                                                      analogWrite(pinMT1L,RegimeMin);
                                                                      if(digitalRead(pinSW1C)) analogWrite(pinMT1L,0);// AZZERO L'USCITA PWM DEL MOTORE MT1

                                                        }
                                                        if(!pinSW2C){                                           //CHIUDO MT2 SE NN è GIA APERTO

                                                                      //creo la rampa di salita per il motore
                                                                      //***** inserire temporizzatore*****

                                                                       for(int i=0;i<Start;i++){                          
                                                                       analogWrite(pinMT2L,i);

                                                                      }

                                                                      //stabilisco il funzionamento a regime max
                                                                     //***** inserire temporizzatore*****
                                                                       analogWrite(pinMT2R,RegimeMax);

                                                                      // rampa di discesa 
                                                                      for(int i=RegimeMax;i>RegimeMin;i--){
                                                                      analogWrite(pinMT2R,i);

                                                                     }

                                                                      // RegimeMin
                                                                      //***** inserire temporizzatore*****
                                                                      analogWrite(pinMT2R,RegimeMin);
                                                                      if(digitalRead(pinSW2C)) analogWrite(pinMT2L,0);// AZZERO L'USCITA PWM DEL MOTORE MT2

                                                        }

                                      Serial.println("ENL LOW");                              
                                      if(digitalRead(pinSW2C)&&digitalRead(pinSW1C))digitalWrite(pinENL,LOW);//SE HO ENTRAMBI ISENSORI DI POSIZIONE APERTO ALLORA RESETTO L'ABILITAZIONE

                                      delay(500);
                                }

                              }
    else {                                                  //ho raggiunto il tempo massimo e blocco la marcia

                              Alimentazione = false;
                              muovi = false;
                              digitalWrite(pinENR,LOW);
                              digitalWrite(pinENL,LOW);
                              ultimaMarcia = ! ultimaMarcia;

          }

}

// funzione per ricevere il segnale dal telecomando

boolean segnale()

{

if ( mySwitch.available() ){

                        if ( mySwitch.getReceivedValue() == keycode ) return true;

                        else return false;
                        mySwitch.resetAvailable();

                        }

else return false;

}

jkwatt commented 9 years ago

can anyone help me?

jantje commented 9 years ago

Is this related to the plugin? If so can you tell me why you think so?

jkwatt commented 9 years ago

Yes is relatore the plug in, i tra to compile bit i have the issue shown onde step over this comment

jantje commented 9 years ago

Can you provide the console output?

jkwatt commented 9 years ago

ok

10:52:20 \ Incremental Build of configuration Release for project cancello_linux ** make all Building file: ../.ino.cpp Starting C++ compile "/home/tecnico/Scaricati/arduino-1.6.0/hardware/tools/avr/bin/avr-g++" -c -g -Os -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10600 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"/home/tecnico/Scaricati/arduino-1.6.0/hardware/arduino/avr/cores/arduino" -I"/home/tecnico/Scaricati/arduino-1.6.0/hardware/arduino/avr/variants/standard" -I"/home/tecnico/Documenti/Arduino/libraries/RCSwitch" -MMD -MP -MF".ino.cpp.d" -MT".ino.cpp.o" -D__IN_ECLIPSE__=1 -x c++ "../.ino.cpp" -o ".ino.cpp.o" -Wall In file included from ../.ino.cpp:13:0: ../cancello_linux.ino:36:14: warning: overflow in implicit constant conversion [-Woverflow] int keycode =5592332; ^ ../cancello_linux.ino: In function 'void loop()': ../cancello_linux.ino:160:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if ( muovi && (millis() - T) < deltaT ){ ^ ../cancello_linux.ino: In function 'boolean segnale()': ../cancello_linux.ino:316:65: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if ( mySwitch.getReceivedValue() == keycode ) return true; ^ Finished building: ../.ino.cpp

Building file: /home/tecnico/Scaricati/arduino-1.6.0/hardware/arduino/avr/cores/arduino/WInterrupts.c Starting C compile "/home/tecnico/Scaricati/arduino-1.6.0/hardware/tools/avr/bin/avr-gcc" -c -g -Os -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10600 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"/home/tecnico/Scaricati/arduino-1.6.0/hardware/arduino/avr/cores/arduino" -I"/home/tecnico/Scaricati/arduino-1.6.0/hardware/arduino/avr/variants/standard" -I"/home/tecnico/Documenti/Arduino/libraries/RCSwitch" -MMD -MP -MF"arduino/WInterrupts.c.d" -MT"arduino/WInterrupts.c.o" -D__IN_ECLIPSE__=1-x c++ "/home/tecnico/Scaricati/arduino-1.6.0/hardware/arduino/avr/cores/arduino/WInterrupts.c" -o "arduino/WInterrupts.c.o" -Wall avr-gcc: error: c++: No such file or directory arduino/core/subdir.mk:175: set di istruzioni per l'obiettivo "arduino/WInterrupts.c.o" non riuscito make: *\ [arduino/WInterrupts.c.o] Errore 1

10:52:21 Build Finished (took 413ms)

jantje commented 9 years ago

something is really wrong in your setup. The plugin is compiling a C source file "WInterrupts.c" partly as a c file (using avr-gcc) and partly as a c++ file "-x c++" but due to a missing space the -x is part of "-D__IN_ECLIPSE__=1" which makes that the gcc compiler is trying to compile the file "c++" which obviously does not exist.

things I think of to do to fix this 1) check your project properties->arduino whether -x c++ is part of the extra compiler options. 2) open your project properties->arduino and select apply

jkwatt commented 9 years ago

I'm sorry I can not figure out which items have to change in the properties of the project, what you mean by "arduino whether". excuse me but i'm a beginner with arduino+eclipse system

jkwatt commented 9 years ago

i solved the issue is only a .ino and .pde setting problem like you see thanks for the help!!!

jkwatt commented 9 years ago

now i like to debug and test the program can you give me a liitle kick to a true direction?

jantje commented 9 years ago

Debugging is advanced stuff. I need to do a video on zero debugging. But I don't get enough incentives. Here are some blog posts and a issues on local debugging.

http://iloapp.baeyens.it/blog/blog?Home&post=19 http://iloapp.baeyens.it/blog/blog?Home&post=20 http://blog.baeyens.it/#post23

https://github.com/jantje/hardware/issues/2 https://github.com/jantje/hardware/issues/1

jkwatt commented 9 years ago

but it work done or not?

jantje commented 9 years ago

it works