Ajuda para criar app MIT App Inventor que detecta dia/noite via LDR com ESP32-C6 Wi-Fi

Spend at least a few hours to learn the basics

Understand the difference between a label and a global variable and then check your blocks... I provided the answer already what needs to be done to fix your blocks

Learn how to use the companion app!

Taifun

Uma Variável Global é um elemento de programação que atua como um espaço de armazenamento na memória do aplicativo. Seu único propósito é guardar dados (como números, textos ou estados lógicos) para que possam ser acessados e alterados pela lógica do programa em qualquer bloco ou procedimento dentro daquela tela. Ela é invisível para o usuário final.

Em contraste, um Rótulo é um componente de Interface do Usuário (UI), ou seja, um objeto visual que o usuário vê na tela. Seu propósito é exibir texto para o usuário, seja uma mensagem estática (como "Bem-vindo") ou um valor dinâmico (como o placar de um jogo). Para exibir o valor contido em uma Variável Global, o programador deve configurar o Rótulo para buscar e mostrar o conteúdo dessa variável.

Portanto, a Variável Global gerencia os dados nos bastidores, enquanto o Rótulo é o meio pelo qual esses dados são comunicados visualmente ao usuário.

penso que agora nao falte nada, mas la esta

Looks good
the only thing is switching screens correctly...

Taifun

1 Like

ent quer dizer que posso ja testar? depois isso da tela do gerente eu ja tenho a SCREEN1 faco nela ent certo?

pq eu tenho 4 ecras, 1 tipo de apresentacao, outro de projeto, outro de sobre e outro de material. mas posso aplicar essa logica tbm

testei a app e nao me aparece os valores dele, nem o estado do dia da me sempre erro 1101

consegui e deu, so tem um roblema da sempre 1023 e noite , constantemente

acredito que agr seja problema de ligacao, o meu ldr e de dois pinos mas estou a ligar ele como sei, mas penso que seja por a resistencia n seja de 10k


alguem sabe como aplicar so dizer o audio apenas 1x ou so quando muda
ou seja quero que esteja de dia e oica esta de dia mudou diz esta de tarde.... mas n quero que esteja esta de dia esta de dia... so quero que diga 1x


Does anyone know how to apply it to just say the audio only once or only when it changes?
In other words, I want it to be daytime and the audio is daytime and it has changed to say it's afternoon... but I don't want it to be daytime, it's daytime... I just want it to say it once.

each time you receive a new value, the blocks in Web.GotText get executed

one player component would have been suficient, just set the source of the player accordingly to play the day afternoon or night sound before playing

Taifun

To prevent the playing of the same sound consecutively, remember the previous sound file name somewhere, and compare it against the new sound file name when you want to play a sound.

If the sound file names are different, play the new sound, otherwise don't play the sound.

Save the new sound file name for next time.

You can also add a cooldown period, if you save the last Instant you played a sound.
Don 't play the sound if it is not yet whatever cooldown period you want past the last time you played a sound.

Clock1.SystemTime (milliseconds from 1970) has the easiest math.

pode me dizer como ficaria nos blocos entao se faz favor

Uploading: image.png…


ent como teria de fazer

como me aconselha a fazer ent? deixei foto em baixo se me pudesse deixar um exemplo de como teria de ficar agradeco

ou seja na foto que deixo sao so executados uma vez certo? ou e tipo um loop repetidamente?

You lack of some basic understanding how things are working
Doing the tutorials would help

Each time you call Web.Get, the corresponding Web.GotText will be executed
And as you are calling it in a Clock.Timer event, it gets executed at each timer interval

Please understand the difference between MinimumInterval and Source, the documentation of the Sound component is here Media

MinimumInterval
Specifies the minimum interval required between calls to Play, in milliseconds. Once the sound starts playing, all further Play calls will be ignored until the interval has elapsed.
Source
The name of the sound file. Only certain formats are supported. See Supported media formats  |  Android media  |  Android Developers.

Taifun