Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!
    0
  •   was successfully added to your cart.
  • Home
  • Buy proxies
  • Extra features
  • Help
  • Contact
  • Login
  • 50% OFF
    BUY NOW!
    50
    PROXIES
    $19
    --------------------
    BUY NOW!
    BUY NOW!
    BUY NOW!
    BUY NOW!
    BUY NOW!
    $29
    $49
    $109
    $179
    $299
    --------------------
    --------------------
    --------------------
    --------------------
    --------------------
    PROXIES
    PROXIES
    PROXIES
    PROXIES
    PROXIES
    100
    200
    500
    1,000
    2,000
    TOP SELLER
    BEST VALUE
    For All Private Proxies!

Estou a desenvolver o seguinte código e estou a utilizar variáveis globais que podem ser alteradas em diferentes partes do código, mas quando altero por exemplo a variável state na função menu() o seu valor não é alterado nas outras funções que a utilizam, ou seja as variáveis são globais mas não são actualizadas. Será por estar a fazer varios processos para correr todas as funções em simultâneo ou estou a fazer alguma coisa mal?

/* menu para acesso as funcionalidades */ #include <wiringPi.h> #include <stdlib.h> #include <stdio.h> #include <stdint.h> #include <unistd.h> #include <stdbool.h> #include <signal.h>  #define sensoralarme    3 #define saidaalarme     9 #define saidaalarme2   26 #define sensoralarme2 11 #define botaoreset 31 #define saidaclimatizacao 12 #define botaoaumenta 0 #define botaodiminui 2 #define saidajanela1 27  #define saidajanela2 23 #define abrirjanela 5 #define fecharjanela 4 #define ldr 29    void menu(); void iluminacacao(); void intrusao(); void janelas(); void toggle(); void disparo(); void reset(); void climatizacao(); void toggleclimatizacao();  //int disparo = (digitalRead(sensoralarme)); int estadoalarme; int estadojanela; int estadojanela2 = 3 ; //int *ptr_int = &estadojanela2; int rr;  int bright=0 ;  int state=0;  int statedisparo=0; int statedisparo2; int toggleCount = 0;   // used to count number of falling edges received. int estadoclimatizacao; int estadoclimatizacao2;     int main() {      int i,r, n=5;     wiringPiSetup ();     pinMode (1, PWM_OUTPUT); /* pwm iluminação*/     pinMode (0, INPUT);/*aumenta luminusidade*/     pinMode (2, INPUT); /* diminui luminusidade*/     pinMode (9, OUTPUT); /* saída disparo alarme*/     pinMode (3, INPUT); /*sensor alarme*/     pinMode (12, OUTPUT); /*saída climatização */     pinMode (27, OUTPUT); /*saída janela abrir */     pinMode (23, OUTPUT); /*saída janela fechar */     pinMode (29, INPUT);/*ldr*/     pinMode (5, INPUT);      pinMode (4, INPUT);      pinMode (6, INPUT);     pinMode (25, OUTPUT);/*sensir janela aberta */      pinMode (saidaalarme, OUTPUT);     pinMode (saidaalarme2, OUTPUT);     pinMode (sensoralarme, INPUT);     pinMode (sensoralarme2, INPUT);     pinMode (botaoreset, INPUT);     digitalWrite(saidaalarme2, LOW);     digitalWrite(saidaalarme, LOW);     digitalWrite(saidaalarme,0);     digitalWrite(saidaclimatizacao,0);     digitalWrite(saidajanela1,0);     digitalWrite(saidajanela2,0);     //pwmWrite (1, 0);     printf("Bem Vindo.\n");      printf("Pressione OK para continuar\n");     getchar();     r=fork();     if(r==0)     {         printf(" \n.....A iniciar sistemas iluminacao\n \n ");         iluminacao();         exit(0);     }     r=fork();     if(r==0)     {         printf(" \n.....A iniciar sistemas intrusao \n \n ");         intrusao();         exit(0);     }     r=fork();     if(r==0)     {         printf(" \n.....A iniciar sistemas  climatizacao\n \n ");         climatizacao();         exit(0);     }     r=fork();     if(r==0)     {         printf(" \n.....A iniciar sistemas janelas \n \n ");         janelas();         exit(0);     }     delay (500);     system( "clear" );     menu();      /*for(i=0; i<n; i++)     {          if(fork()) break;     }      if(i==n)     {         menu();      }     else     {         printf(" \n.....A iniciar sistemas \n \n ");     }     switch(i)     {         case 1:         {             iluminacao();             break;         }         case 2:         {             intrusao();             break;         }         case 3:         {             climatizacao();             break;         }         case 4:         {             janelas();             break;         }     }*/   /*int r;  r=fork();  if (r==0)  {iluminacao();intrusao();climatizacao();janelas();}  else  {menu();}     return 0;*/   }  void menu() {     int escolha1;     int r;     int estadoclimatizacao;     int lum;     int estadointrusao;       //printf(" estado janela2:%d\n",  *ptr_int);     printf("SISTEMAS \n");     printf("\n");     printf("Escolha umas das seguintes opções:\n");     printf("1. iluminação.\n");     printf("2. Intrusão.\n");     printf("3. Climatização.\n");     printf("4. Janelas.\n");     printf("0. Sair.\n");     scanf("%d", &escolha1);     switch ( escolha1 )     {         case 1:         {             printf("intruduza o nivel de luminusidade desejado de 0 a 10 \n");             scanf("%d", &lum);             bright=lum*102.4;             printf("%d: lum\n",bright);             pwmWrite (1, bright);             menu();             break;         }         case 2:         {             printf(" Para ligar prima 1\n Para desligar prima 0\n");             scanf("%d", &estadointrusao);             if (estadointrusao==1 && state ==0)             {                 digitalWrite(saidaalarme, HIGH);                 state=1;                 menu();                 break;             }             else if (estadointrusao==1 && state ==1)             {                 printf(" Sistema já se encontra ligado!\n");                 menu();             }             if (estadointrusao==0 && state == 1 && statedisparo == 0)             {                 digitalWrite(saidaalarme, LOW);                 state=0;                 menu();                 break;             }             else if (estadointrusao==0 && state ==0)             {                 printf(" Sistema já se encontra desligado!\n");                 menu();             }             else if (estadointrusao==0 && state ==1 && statedisparo == 0)             {                 printf(" Sistema terá de ser desligado localmente!\n DISPARO\n");                 menu();             }         }         case 3:         {             printf(" Para ligar prima 1\n Para desligar prima 0\n");             scanf("%d", &estadoclimatizacao);             if ( estadoclimatizacao == 1 )             {                 digitalWrite(saidaclimatizacao,1);                 menu();             }             if ( estadoclimatizacao == 0 )             {                 digitalWrite(saidaclimatizacao,0);                 menu();             }         }         case 4:         {             printf(" Para abrir prima 1\n Para fechar prima 0\n Para verificar o estado prima 2\n");             scanf("%d", &estadojanela);             if (estadojanela ==2 && estadojanela2 ==1)                 {                     printf("janela ABERTa \n");                     menu();                 }             if (estadojanela==2 && estadojanela2 == 0)                 {                     printf("janela fechada \n");                     menu();                 }             if (estadojanela !=2 && rr==0)             {                         menu();                     //sleep(600);                }             else              {                 printf("passar para processo ja aberto \n");                 menu();             }         }             case 0:         {             kill(0, SIGTERM);             /*comando para matar todos os processos criados*/             digitalWrite(saidaalarme2, LOW);         digitalWrite(saidaalarme, LOW);         digitalWrite(saidaalarme,0);         digitalWrite(saidaclimatizacao,0);         digitalWrite(saidajanela1,0);         digitalWrite(saidajanela2,0);         pwmWrite (1, 0);             return (0);             break;         }     }  }  void iluminacao() {    //int buttonmais = (digitalRead(0) );   int buttonmenos = (digitalRead(2) );     printf ("dimmer\n") ;    if (wiringPiSetup () == -1)     exit (1) ;     pwmWrite (1, bright);     while (1)   {         while (digitalRead(0) != LOW && digitalRead(2) == LOW && digitalRead(29) !=0)       {            if (bright  < 1024 && bright >= 0)         {         bright = bright+1;           pwmWrite (1, bright) ;         delay (4) ;          }         }     while ( digitalRead(2) != LOW && digitalRead(0) == LOW && digitalRead(29) !=0)     {         if (bright  <= 1024 && bright > 0)         {             bright = bright-1;         pwmWrite (1, bright) ;         delay (4) ;         }     }      if (digitalRead(0) != LOW && digitalRead(2) != LOW)       {           bright = 0;           pwmWrite (1, bright);       } }   }   void janelas() {     while (1)     {         if ( estadojanela == 1 && digitalRead(25)==0 )/*abre janela via linha de comandos*/                 {                     digitalWrite(saidajanela1,1);                     digitalWrite(saidajanela2,0);                     delay(500);                     estadojanela2 = 1;                     estadojanela=3;                     printf("ABERTO \n");                     digitalWrite(saidajanela1,0);                     digitalWrite(25,1);                  }                 if ( estadojanela == 0 && digitalRead(25)==1)/* fecha janela via linha de comandos*/                 {                     digitalWrite(saidajanela1,0);                     digitalWrite(saidajanela2,1);                     delay(500);                     estadojanela2=0;                     estadojanela=3;                     printf("Fechado \n");                     digitalWrite(saidajanela2,0);                     digitalWrite(25,0);                  }                 if ( estadojanela == 1  && (digitalRead(saidajanela1)==1)  )/*para abertura de janela*/                 {                     digitalWrite(saidajanela1,0);                     digitalWrite(saidajanela2,0);                       printf("ABERTura parada \n");                    }                 if ( estadojanela == 0  && (digitalRead(saidajanela2)==1)  )/*para fecho da janela*/                 {                     digitalWrite(saidajanela1,0);                     digitalWrite(saidajanela2,0);                       printf("fecho parada \n");                    }                 if ( digitalRead(5)!=0 && digitalRead(25)==0 )/*abre janela via linha de comandos*/                 {                     digitalWrite(saidajanela1,1);                     digitalWrite(saidajanela2,0);                     delay(500);                     estadojanela2 = 1;                     estadojanela=3;                     printf("ABERTO \n");                     digitalWrite(saidajanela1,0);                     digitalWrite(25,1);                  }                 if ( digitalRead(4)!=0 && digitalRead(25)==1)                 {                     digitalWrite(saidajanela1,0);                     digitalWrite(saidajanela2,1);                     delay(500);                     estadojanela2=0;                     estadojanela=3;                     printf("Fechado \n");                     digitalWrite(saidajanela2,0);                     digitalWrite(25,0);                  }     }  }  void intrusao() {     if (wiringPiISR(sensoralarme,INT_EDGE_FALLING,&toggle) != 0)     {         printf("Registering ISR failed\n");         return 2;     }     if (wiringPiISR(sensoralarme2,INT_EDGE_FALLING,&disparo) != 0)     {         printf("Registering ISR failed\n");         return 2;     }     if (wiringPiISR(botaoreset,INT_EDGE_FALLING,&reset) != 0)     {         printf("Registering ISR failed\n");         return 2;     }     if ( saidaalarme == 1 && sensoralarme2 == 1)     {         digitalWrite(saidaalarme2, HIGH);         delay(10);     }      // wait for ever so the program doesn't terminate.     while(1)     {           // Yield the thread so CPU doesn't run 100%         delay(5000);     } }  void toggle() {      // NOTE: LED is connected to +3.3V and to the PIN.     // So configuration is active low.      if(state==1 && statedisparo ==0)     {         // Set -ve lead of LED to ground.         digitalWrite(saidaalarme,LOW);         state = 0;         printf("%d: ALARME OFF\n", toggleCount++);     }       else     {         // Set -ve lead of LED to +3.3V.         digitalWrite(saidaalarme, HIGH);         state = 1;         printf("%d: ALARME ON\n", toggleCount++);     }  } void disparo() {     //statedisparo = 0;     if(state==1 && statedisparo==0)     {         // Set -ve lead of LED to ground.         digitalWrite(saidaalarme2,LOW);         statedisparo = 1;         statedisparo2 = 1;        // printf("%d: disparo off\n", toggleCount++);      /*  do     {             digitalWrite (LedPin2, HIGH) ; delay (300) ;         digitalWrite (LedPin2, LOW) ; delay(300) ;     }     while (state==1);*/            while(statedisparo2==1)         {               digitalWrite (saidaalarme2, HIGH) ; delay (300) ;             digitalWrite (saidaalarme2, LOW) ; delay(300) ;           }       }     else if(state==0 && /*ButtonPin2 ==1*/ statedisparo == 0)     {         // Set -ve lead of LED to +3.3V.         digitalWrite(saidaalarme2, HIGH);         //statedisparo = 1;         printf("%d: ALARME OFF\n", toggleCount++);         printf("%d: disparo ON\n", toggleCount++);         digitalWrite (saidaalarme2, HIGH) ; delay (500) ;         pwmWrite (1, 256);         digitalWrite (saidaalarme2, LOW) ;       }   } void reset() {     if(state == 1)     {         // Set -ve lead of LED to +3.3V.         digitalWrite(saidaalarme2, LOW);         digitalWrite(saidaalarme, LOW);         //statedisparo = 1;         printf("%d: RESET\n", toggleCount++);         state=0;         statedisparo=0;         statedisparo2=0;         return;       } }     void climatizacao() {     //int flag=0;     printf("climatização\n");      if (wiringPiISR(digitalRead(6),INT_EDGE_FALLING,&toggleclimatizacao) != 0)     {         printf("Registering ISR failed\n");         return 2;     }     while (1)     {         //if (digitalRead(6)!=0 && estadoclimatizacao2==0 && flag==0)         //{             //digitalWrite(saidaclimatizacao,1);             //flag=1;         //  estadoclimatizacao2=1;         //}         //if (digitalRead(6)!=0 && estadoclimatizacao2==1 && flag ==1)         //{             //digitalWrite(saidaclimatizacao,0);             //flag=0;         //  estadoclimatizacao2=0;         //}          delay(5000);      } }  void toggleclimatizacao() {      if(estadoclimatizacao==1 && statedisparo ==0)     {          digitalWrite(saidaclimatizacao,LOW);         estadoclimatizacao = 0;         printf(" climatizacao OFF\n");     }       else     {         // Set -ve lead of LED to +3.3V.         digitalWrite(saidaclimatizacao, HIGH);         estadoclimatizacao = 1;         printf("climatizacao ON\n");     }  } 

✓ Extra quality

ExtraProxies brings the best proxy quality for you with our private and reliable proxies

✓ Extra anonymity

Top level of anonymity and 100% safe proxies – this is what you get with every proxy package

✓ Extra speed

1,ooo mb/s proxy servers speed – we are way better than others – just enjoy our proxies!

50 proxies

$19/month

50% DISCOUNT!
$0.38 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

100 proxies

$29/month

50% DISCOUNT!
$0.29 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

200 proxies

$49/month

50% DISCOUNT!
$0.25 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

500 proxies

$109/month

50% DISCOUNT!
$0.22 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

1,000 proxies

$179/month

50% DISCOUNT!
$0.18 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

2,000 proxies

$299/month

50% DISCOUNT!
$0.15 per proxy
✓ Private
✓ Elite
✓ Anonymous
Buy now

USA proxy location

We offer premium quality USA private proxies – the most essential proxies you can ever want from USA

100% anonymous

Our proxies have TOP level of anonymity + Elite quality, so you are always safe and secure with your proxies

Unlimited bandwidth

Use your proxies as much as you want – we have no limits for data transfer and bandwidth, unlimited usage!

Superfast speed

Superb fast proxy servers with 1,000 mb/s speed – sit back and enjoy your lightning fast private proxies!

99,9% servers uptime

Alive and working proxies all the time – we are taking care of our servers so you can use them without any problems

No usage restrictions

You have freedom to use your proxies with every software, browser or website you want without restrictions

Perfect for SEO

We are 100% friendly with all SEO tasks as well as internet marketing – feel the power with our proxies

Big discounts

Buy more proxies and get better price – we offer various proxy packages with great deals and discounts

Premium support

We are working 24/7 to bring the best proxy experience for you – we are glad to help and assist you!

Satisfaction guarantee

24/7 premium support, free proxy activation and 100% safe payments! Best reliability private proxies for your needs!

Best Proxy Packs

  • 2,000 Private Proxies $600.00 $299.00 / month
  • 1,000 Private Proxies $360.00 $179.00 / month

Quick Links

  • More information
  • Contact us
  • Privacy Policy
  • Terms and Conditions

Like And Follow Us


Copyright ExtraProxies.com | All Rights Reserved.
  • Checkout
  • Contact
  • Help
  • Home
  • My Account
  • My Cart
  • News
  • Privacy Policy
  • Proxy features
  • Proxy packs
  • Terms and Conditions
Private Proxies – Buy Cheap Private Elite USA Proxy + 50% Discount!
    0 items