Ir para conteúdo
View in the app

A better way to browse. Learn more.

EletrônicaBR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Vinicius-MAfonso

Membros
  • Registrado em

  • Última visita

  • Créditos EBR

    0
  1. Olá colegas, tudo bem?! Comecei um projeto no arduino para a matéria de estrutura de dados da faculdade, é sobre um gerenciamento de filas usando C, ele cria a senha normal e preferencial, mas quando é para chamar ele não consegue chamar nenhuma fila, já fiz o mesmo código no computador usando o console e funcionou, mas no arduino não, podem me ajudar?, segue abaixo o vídeo e o código. #include <U8glib.h> #include <Adafruit_SSD1306.h> #include <Adafruit_GFX.h> #include <Adafruit_SPITFT.h> #include <Adafruit_SPITFT_Macros.h> #include <gfxfont.h> #include <Wire.h> //INCLUSÃO DE BIBLIOTECA #define SCREEN_WIDTH 128 #define SCREEN_HEIGHT 64 Adafruit_SSD1306 display = Adafruit_SSD1306(); #define limit 10 char buff[40]; char buff1[25]; char buff2[25]; struct fila_struct { int position[limit]; int initial_position; int end_position; }; struct fila_struct fila; int num_atendimento = 0; int num = 0; int senha = 0; int senhaP = 0; bool sair = true; void setup(){ pinMode(12, INPUT); pinMode(4, OUTPUT); pinMode(13, INPUT); pinMode(2, OUTPUT); Wire.begin(); //INICIALIZA A BIBLIOTECA WIRE display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //INICIALIZA O DISPLAY COM ENDEREÇO I2C 0x3C display.setTextColor(WHITE); //DEFINE A COR DO TEXTO display.setTextSize(1); //DEFINE O TAMANHO DA FONTE DO TEXTO display.clearDisplay(); //LIMPA AS INFORMAÇÕES DO DISPLAY } void loop() { fila.initial_position = 0; fila.end_position = 0; if(digitalRead(12) == 1){ display.setCursor(0,0); //POSIÇÃO EM QUE O CURSOR IRÁ FAZER A ESCRITA retirar_senha(); display.print(buff); //ESCREVE O TEXTO NO DISPLAY display.display(); //EFETIVA A ESCRITA NO DISPLAY delay(150); display.clearDisplay(); //LIMPA AS INFORMAÇÕES DO DISPLAY } if(digitalRead(13) == 1){ display.setCursor(0,0); //POSIÇÃO EM QUE O CURSOR IRÁ FAZER A ESCRITA retirar_senhaP(); display.print(buff); //ESCREVE O TEXTO NO DISPLAY display.display(); //EFETIVA A ESCRITA NO DISPLAY delay(1500); display.clearDisplay(); //LIMPA AS INFORMAÇÕES DO DISPLAY } if(digitalRead(2) == 1){ display.setCursor(0,0); //POSIÇÃO EM QUE O CURSOR IRÁ FAZER A ESCRITA fila_decrement(); display.print(buff1); //ESCREVE O TEXTO NO DISPLAY display.display(); //EFETIVA A ESCRITA NO DISPLAY delay(1500); display.clearDisplay(); //LIMPA AS INFORMAÇÕES DO DISPLAY } } void fila_increment(int senha){ if (fila.end_position == limit) { } else { fila.position[fila.end_position] = senha; fila.end_position++; } } void fila_decrement(){ if (fila.initial_position == fila.end_position) { sprintf(buff1,"Fila vazia"); } else { sprintf(buff1," "); for (int i=0; i < limit -1; i++){ fila.position[i] = fila.position[i+1]; } fila.position[fila.end_position] = 0; fila.end_position--; num_atendimento++; } ver_fila(); } void ver_fila() { sprintf(buff1,"Fila: "); for (int i=0; i<limit; i++){ sprintf(buff1,"%d, ", fila.position[i]); } sprintf(buff1,"Senha chamada: %d", num_atendimento); limpar_msg(0); } void retirar_senha(){ int sua_senha; if (validar() == 1) { sua_senha = senha + 1; sprintf(buff,"Sua senha: %d \nNormal", sua_senha); senha++; fila_increment(sua_senha); } } void retirar_senhaP(){ int sua_senha; if (validar() == 1) { sua_senha = senhaP + 1; sprintf(buff,"Sua senha: %d \nTipo: Prioritaria", sua_senha); senhaP++; fila_increment(sua_senha); } } int validar(){ if (senha == limit || senhaP == limit ) { return -1; } else if(senha <= limit || senhaP <= limit) { return 1; } } Desde já agradeço qualquer resposta, Att. Viniciu M. Afonso arduino.mp4

Account

Navigation

Pesquisar

Pesquisar

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.