Pesquisar neste blog

12/11/2022

Formulários com HTML5


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Reccebendo dados por formulário</title>
</head>
<body>
<form action="processa.php" method="post">
<label>Text</label>
<input type="text" name="texto1" placeholder="Text">
<br>

<label>password</label>
<input type="password" name="senha">
<br><br>

<label>Oculto</label>
<input type="hidden" name="informacao_oculta" value="mensagem oculta">

<label>Select</label>
<select name="selecao">
<option value="1">Opção 1</option>
<option value="2">Opção 2</option>
</select>
<br><br>

<label>Radio</label><br>
<input type="radio" name="radio1" value="1">Valor 1 <br>
<input type="radio" name="radio1" value="2">Valor 2 <br>
<br>
<input type="checkbox" name="ck1" value="1">Valor 1 <br>
<input type="checkbox" name="ck1" value="2">Valor 2 <br>
<input type="checkbox" name="ck1" value="3">Valor 3 <br>
<br>
<input type="submit" value="Enviar" name="submit">
</form> <!--tag form-->

</body>
</html>
































11/11/2022

Motor DC com PIC 16F877A

Controle de velocidade do motor DC
Botão 1: gira 90°
Botão 2: gira 45°
Botão 3: gira 15°

Código feito em CCS C Compiler

#include <16F877A.h>
#fuses XT, NOWDT, NOPROTECT, PUT, BROWNOUT
#use delay(clock = 4MHz)

#define BOTAO1 PIN_B1
#define BOTAO2 PIN_B2
#define BOTAO3 PIN_B3

void main(){
   setup_timer_2(T2_DIV_BY_1, 249, 1);
   setup_ccp1(CCP_PWM);
   disable_interrupts(GLOBAL);
   port_b_pullups(TRUE);
   
   while(TRUE){
      if(!input(BOTAO1)){
         set_pwm1_duty(255);// 90°
         
      }else if(!input(BOTAO2)){// 45°
         set_pwm1_duty(153);
         
      }else if(!input(BOTAO3)){ // 15°
         set_pwm1_duty(51);
         
      }else{
         set_pwm1_duty(0);
      }
   }
}
























Tabelas com HTML

<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tabelas</title>
</head>
<body>
<table>
<tr><th>A1</th> <th>A2</th> <th>A3</th> </tr>
<tr><th>B1</th> <th>B2</th> <th>B3</th> </tr>
<tr><th>C1</th> <th>C2</th> <th>C3</th> </tr>
</table>
</body>
</html>









10/11/2022

Linhas horizontais e listas com HTML

<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Aprendendo sobre tags</title>
</head>
<body>
<p>Olá mundo!</p>
<hr>
<h1>Título 1</h1>
<h2>Título 2</h2>
<h3>Título 3</h3>
<h4>Título 4</h4>
<h5>Título 5</h5>
<p>Texto comum</p>
<hr>

<!--Lista ordenada-->
<ol>
<li>Primeiro elemento</li>
<li>Segundo elemento</li>
<li>Terceiro elemento</li>
</ol>
<!-- Lista não ordenada -->
<ul>
<li>Primeiro elemento</li>
<li>Segundo elemento</li>
<li>Terceiro elemento</li>
</ul>
</body>
</html>


Saída gerada no navegador


09/11/2022

Parágrafos e formatações com HTML5

<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Minha primeira página</title>
</head>
<body>
<header></header>
<div>Olá mundo!</div>
<footer></footer>
<p>
<b>Texto em negrito</b><br>
<i>Texto em itálico</i><br>
<u>Texto sublinhado</u><br>
<sub>Texto subscrito</sub><br>
<sup>Texto sobrescrito</sup><br>
<big>Texto com fonte maior do que o padrão</big><br>
<small>Texto com fonte menor do que o padrão</small><br>
<em>Texto em itálico</em><br>
<strong>Texto em negrito</strong>
<style>
p {color: greenyellow;} /*texto em verde limão*/
body{background-color: red; }/*plano de fundo*/
</style>
</p>
</body>
</html>


Saída gerada no navegador
























07/11/2022

Inserir linhas em outra planilha no google sheets

Objetivo: Inserir quantidade x de linhas em outra planilha com google sheets

Planilha atual


















Script para inserir várias linhas em outra planilha

function InserirLinhasNovaPlanilha(){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet1 = ss.getSheetByName("Rota"); // Guia da planilha usada
  
  //link da planilha onde deseja inserir
  var ssBase = SpreadsheetApp.openById("1kVaDyY_vSwNQbjCyuKKWczucfpWInhNSU0arlOnuN_4");
  var sheetBase = ssBase.getSheetByName("H1");// nome da aba que deseja salvar
  var ultimaLinha = guiaMenu.getLastRow();
  
  for (let i = 0i < ultimaLinhai++){
    ssBase.getRange('1:1').activate();
    ssBase.getActiveSheet().insertRowsBefore(ssBase.getActiveRange().getRow(), 1);
    ssBase.getActiveRange().offset(001ssBase.getActiveRange().getNumColumns()).activate();
  }
}

Saída gerada















01/11/2022

Ciclo com PIC 16F877A

Objetivo: Fazer um frequenciometro com pic 16F877A e exibe em tela seu pulso.

Resolução feita em CCS C Compiler

#include <16F877A.h>
#fuses xt, nowdt, noprotect, put, brownout
#use delay(clock = 4M)

#define RS PIN_E0
#define EN PIN_E1

void Inicializa(void);
void Lcd_Inst(char dado);
void Lcd_Dado(char dado);

int16 periodo1, periodo2;
int32 periodo;
boolean flag = 0;

void main(){

   Inicializa();
   Lcd_Inst(0x82);
   printf(lcd_dado, "\fPeriodo\n");

   while(TRUE){
      //TODO: User Code
      Lcd_Inst(0xC2);
      printf(lcd_dado, "TEMPO = %lu us", periodo);
      
   }

}

#int_ccp1
void ccp1_int(){
   if (flag == 0){
      periodo1 = CCP_1;
      flag = 1;
   }else{
      periodo2 = CCP_1;
      periodo = ((periodo2 - periodo1) * 2);
      Set_Timer1(0);
      flag = 0;
   }
}

void Inicializa(void){
   Setup_Timer_1(T1_INTERNAL|T1_DIV_BY_2);
   Setup_ccp1(CCP_CAPTURE_RE);
   Enable_Interrupts(GLOBAL);
   Enable_Interrupts(INT_CCP1);
   
   Lcd_Inst(0x38);
   delay_ms(1);
   Lcd_Inst(0x38);
   Lcd_Inst(0x0C);
   Lcd_Inst(0x06);
   Lcd_Inst(0x01);
   delay_ms(1);
}

void Lcd_Inst(char dado){
   Disable_Interrupts(GLOBAL);
   output_low(RS);
   output_d(dado);
   delay_cycles(2);
   output_high(EN);
   delay_ms(1);
   output_low(EN);
   Enable_Interrupts(GLOBAL);
}

void Lcd_Dado(char dado){
   Disable_Interrupts(GLOBAL);
   output_high(RS);
   output_d(dado);
   delay_cycles(2);
   output_high(EN);
   delay_ms(1);
   output_low(EN);
   Enable_Interrupts(GLOBAL);
}

Software: Proteus 7.9






















17/10/2022

Contador LDR com CI 555 + 74LS90,47

Objetivo: Realizar um contador através de um LDR com CI 555

Componentes:
1 Resistor 220 Ω
1 Resistor 2,2 KΩ
1 Resistor 10 KΩ
1 CI 555
1 CI 74LS90
1 LDR 
1 CI 74LS47
1 Display anodo
1 Capacitor cerâmico 47 uF










Simulação no software Proteus versão 7.9

















11/10/2022

Banco de Dados MySQL no PHP

Objetivo: Fazer conexão e criar o banco de dados usando MySQL 

Necessário instalar o MySQL disponível em: https://www.phpmyadmin.net/

Código feito em PHP
Saída gerada



<?phpB
# Conexão com o banco de dados MySQL ***********************
$servidor = "localhost";
$usuario = "root";
$senha = "";
$database = "aula_php";
$conexao = mysqli_connect($servidor, $usuario, $senha, $database);
# Criando tabelas usando PHP *******************************
# Tabela cursos (nome do curso, carga horaria)
$query = "CREATE TABLE CURSOS(
id_curso int not null auto_increment,
nome_curso varchar(255) not null,
carga_horaria int not null,
primary key(id_curso)
)";
$executar = mysqli_query($conexao, $query);
# Tabela alunos (nome do aluno, data de nascimento)
$query = "CREATE TABLE ALUNOS(
id_aluno int not null auto_increment,
nome_aluno varchar(255) not null,
data_nascimento varchar(255),
primary key(id_aluno)
)";
$executar = mysqli_query($conexao, $query);
# Tabela alunos_cursos (aluno, curso)
$query = "CREATE TABLE ALUNOS_CURSOS(
id_aluno_curso int not null auto_increment,
id_aluno int not null,
id_curso int not null,
primary key(id_aluno_curso)
)";
$executar = mysqli_query($conexao, $query);
# Inserir dados nas tabelas *****************************
$query = "INSERT INTO ALUNOS(nome_aluno, data_nascimento) VALUES('Jose',
'01-01-1990')";
$executar = mysqli_query($conexao, $query);
$query = "INSERT INTO ALUNOS(nome_aluno, data_nascimento) VALUES('Maria',
'01-04-1991')";
$executar = mysqli_query($conexao, $query);
# Inserir cursos
$query = "INSERT INTO CURSOS(nome_curso, carga_horaria) VALUES
('PHP E MYSQL', 10)";
$executar = mysqli_query($conexao, $query);
# Alunos curso
$query = "INSERT INTO ALUNOS_CURSOS(id_aluno, id_curso) VALUES(8, 1)";
mysqli_query($conexao, $query);
if(mysqli_query($conexao, "DELETE FROM ALUNOS WHERE ID_ALUNO = 9
or ID_ALUNO = 10")){ echo 'Apagado com sucesso';
}
else{
echo 'Falha ao apagar dados';
}
if(mysqli_query($conexao, "UPDATE ALUNOS SET NOME_ALUNO =
'Jose Miguel' WHERE ID_ALUNO = 7")){ echo 'Sucesso';
}
if(mysqli_query($conexao, "UPDATE ALUNOS SET NOME_ALUNO =
'Maria Capitolina' WHERE ID_ALUNO = 8")){ echo 'Sucesso';
}
echo '<table border=1>
<tr>
<th>id</th>
<th>Nome</th>
<th>Data de nascimento</th>
</tr>';
$consulta = mysqli_query($conexao, "SELECT * FROM ALUNOS");
while($linha = mysqli_fetch_array($consulta)){
echo '<tr><td>'.$linha['id_aluno'].'</td>';
echo '<td>'.$linha['nome_aluno'].'</td>';
echo '<td>'.$linha['data_nascimento'].'</td></tr>';
}
echo '</table>';
$consulta = mysqli_query($conexao, "SELECT ALUNOS.NOME_ALUNO,
CURSOS.NOME_CURSO FROM ALUNOS, CURSOS, alunos_cursos
where ALUNOS_CURSOS.ID_ALUNO = ALUNOS.ID_ALUNO AND
ALUNOS_CURSOS = CURSOS.ID_CURSOS");
while($linha = mysqli_fetch_array($consulta)){
echo '<tr><td>'.$linha['nome_curso'].'</td>';
echo '<td>'.$linha['nome_aluno'].'</td>';
}
echo '</table>';
$consulta = mysqli_query($conexao, "SELECT ALUNOS.nome_aluno,
CURSOS.nome_curso FROM ALUNOS, CURSOS, ALUNOS_CURSOS
WHERE ALUNOS_CURSOS.id_aluno = ALUNOS.id_aluno AND
ALUNOS_CURSOS.id_curso = CURSOS.id_curso");
echo '<table border=1><tr><th>Nome do aluno</th><th>Nome do curso</th></tr>';
while($linha = mysqli_fetch_array($consulta)){
echo '<tr><td>'.$linha['nome_aluno'].'</td>';
echo '<td>'.$linha['nome_curso'].'</td></tr>';
}
echo '</table>';



Palavras chave:

MySQL-database yn PHP
Database MySQL ing PHP
MySQL-database i PHP
MySQL databáze v PHP
PHP da MySQL ma'lumotlar bazasi
מסד נתונים של MySQL ב-PHP
PHP의 MySQL 데이터베이스
База данных MySQL на PHP
MySQL baza podataka u PHP-u

28/09/2022

Inserir linhas com API Google Sheets

Objetivo: Inserir uma quantidade X de linhas em uma aba com base na última linha com dados em outra aba do google sheets.

Código utilizado:

function QtdLinhas2(){
  var planilha = SpreadsheetApp.getActiveSpreadsheet();
  var guiaMenu = planilha.getSheetByName("Dados 1");
  var guiadados = planilha.getSheetByName("Dados 2");
  var ultimaLinha = guiaMenu.getLastRow();

  Browser.msgBox(ultimaLinha);

  for(let i = 0i < ultimaLinhai++){
    guiadados.getRange('1:1').activate();
    planilha.getActiveSheet().insertRowsBefore(guiadados.getActiveRange().getRow(), 1);
    guiadados.getActiveRange().offset(001guiadados.getActiveRange().getNumColumns()).activate();
  }
}































Palavras chave:

Geli safafka Google Sheets API
Chèn hàng bằng API Google Trang tính
Inserere Ordines apud Google rudentis API
Indsæt rækker med Google Sheets API
Inserați rânduri cu API-ul Google Sheets
Google Sheets API yordamida qatorlarni kiriting
गूगल शीट्स एपीआई के साथ पंक्ति डालें
Вставка строк с помощью Google Sheets API
Wstaw wiersze za pomocą interfejsu API Arkuszy Google
Lebokake Rows nganggo Google Sheets API
Rigen ynfoegje mei Google Sheets API

27/09/2022

Timer 0 com PIC 16F877A

O TIMERO está programado para causar uma interrupção a cada certo tempo, neste caso 20 ms. Toda vez que a interrupção ocorre, teste se o botão foi pressionado. No caso de ter sido pressionado, ele com teste se é um toque curto ou mais de 3 segundos. Para este último caso é verificado se o botão é pressionado durante 150 interrupções do TIMER (3s/20ms = 150). Se o botão não foi pressionado, é designado como o Function_D6 = 0, se foi pressionado uma vez por mais de 3 segundos é designado como Função JD 6 = 1, se tiver sido pressionado momentaneamente é designado como Function_D6 = 2 e se foi pressionado por mais de 3 segundos uma segunda vez é designada como o Function_D6 = 3. 
Para distinguir se foi pressionado por mais de 3 segundos uma ou duas vezes, é utilizada uma variável de controle (que se chamará CON_D6) que pode ser zero ou um, dependendo se é a primeira ou a segunda vez que é pressionado.
Para controlar o tempo que o botão é pressionado, é utilizada uma variável (D6) que irá
incrementando se o botão for pressionado e ocorrer uma interrupção TMRO.












26/09/2022

Ultima linha com dados no API Google Sheets

Objetivo: Realizar a quantificação da última linha com dados no Google Sheets

Código 1:

function QtdLinhas() {
  var planilha = SpreadsheetApp.getActiveSpreadsheet();
  var guiaMenu = planilha.getSheetByName("Dados 1");
  
  var ultimaLinha = guiaMenu.getLastRow(); //ultima linha com dados
  Browser.msgBox(ultimaLinha);

}

Saída no Google Sheets

























Palavras chave:

Last line with data in Google Sheets API
Última línea con datos en Google Sheets API
Последняя строка с данными в Google Sheets API
Останній рядок із даними в API Google Таблиць
שורה אחרונה עם נתונים ב-Google Sheets API
Sista raden med data i Google Sheets API
Lescht Zeil mat Daten an Google Sheets API
Zadnji redak s podacima u Google Sheets API-ju
Dòng cuối cùng với dữ liệu trong API Google Trang tính
Khadka u dambeeya ee xogta Google Sheets API

20/09/2022

Servo Motor com CI 555

Software Proteus 7.9



























Componentes:

1 Capacitor 10 uF
1 Capacitor 100 nF
1 Led
1 Potenciômetro
1 Resistor 220 ohms
1 Fonte de alimentação 12V
1 CI 555
1 Servo Motor

11/09/2022

Uso de for no google Sheets

Código na IDE do google sheets em linguagem JavaScript

function debug(){
  var square = 0;
  for(var i = 0; i < 10; i++){
    square = i + 1;
    Logger.log(square);
  }
}







09/09/2022

Notificação no Apps google sheets

Código feito na IDE do google sheets

function MSG(){
  SpreadsheetApp.getActiveSpreadsheet().toast("Atenção !", "NOTIFICAÇÃO");
}














Palavras chave:

Cuadro de mensaje en hojas de Google de aplicaciones
Message box in Apps google sheets
Pole wiadomości w arkuszach Google Apps
Üzenőmező az Apps Google-lapokon
Apps google sheet 中的消息框
תיבת הודעות ב-Google Sheets של Apps
Оквир за поруке у Гоогле табелама за апликације
Hafatra hafatra ao amin'ny Apps google sheets
Meddelelsesfelt i Apps google sheets

06/09/2022

Mensagem box no Apps google sheets

Código feito na IDE do google sheets

function MSG(s1, s2){
  Browser.msgBox("Blog da Engenharia Cotidiana", "Bem Vindo(a)", Browser.Buttons.OK);
}

















Palavras chave:

Cuadro de mensaje en hojas de Google de aplicaciones
Message box in Apps google sheets
Pole wiadomości w arkuszach Google Apps
Üzenőmező az Apps Google-lapokon
Apps google sheet 中的消息框
תיבת הודעות ב-Google Sheets של Apps
Оквир за поруке у Гоогле табелама за апликације
Hafatra hafatra ao amin'ny Apps google sheets
Meddelelsesfelt i Apps google sheets

02/09/2022

Interrupção com PIC 16F877A

Objetivo: Acionar por meio de interrupção uma operação já em andamento

Código feito em CCS C Compiler

#include <16F877A.h>
#use delay(clock = 20MHz)
#fuses XT, NOWDT, PUT, NOWRT
#use fast_io(B)

#INT_EXT
ext_isr(){
   output_toggle(pin_B7);
}

void main(){
   set_tris_B(0x01); //B0 com entrada, B7 como salida
   output_low(PIN_B7);
   port_b_pullups(TRUE);
   enable_interrupts(int_ext);
   ext_int_edge(L_TO_H);
   enable_interrupts(GLOBAL);
   WHILE(1){
            
      for(int i = 0; i < 100; i++){
         output_toggle(PIN_D0);
         delay_ms(500);
      }
   }
   
}


Saída gerada no software Proteus 7.9





30/08/2022

TERMÔMETRO COM PIC 16F877A

(Componente NTSA0WB203)

Código feito em CCS C Compiler

//PÁGINA 136
#include <16F877A.h>
#device adc = 10
#fuses XT, NOWDT
#use delay (clock = 4MHz)
#include <math.h>
#include <lcd.c>

float tv, tr, temp, y;
int16 value;

void main(){
   lcd_init();   
   setup_port_a(ALL_ANALOG);
   setup_adc(ADC_CLOCK_INTERNAL);
   set_adc_channel(0);
   delay_ms(10);
   
   while(true){
      value = read_adc();
      tv = 5.0 * value / 1024.0;
      tr = tv * 10000.0 / (5.0 - tv);
      y = log(tr / 20000.0);
      y = (1.0 / 298.15) + (y * (1.0 / 4050.0));
      temp = 1.0 / y;
      temp = temp - 273.15;
      
      printf(lcd_putc, "\f\nT = %04.2fC",temp);
      delay_ms(1000);
   }
}



24/08/2022

Gráfico de barras no google sheets
















Comando utilizado:

=SPARKLINE(B3;{"charttype"\"bar";"max"\1;"color1"\"orange"})
=SPARKLINE(B4;{"charttype"\"bar";"max"\1;"color1"\"red"})
=SPARKLINE(B5;{"charttype"\"bar";"max"\1;"color1"\"7CFC00"})
=SPARKLINE(B6;{"charttype"\"bar";"max"\1;"color1"\"grey"})
=SPARKLINE(B7;{"charttype"\"bar";"max"\1;"color1"\"DeepSkyBlue"})

17/08/2022

Onda senoidal PWM com PIC 16F877A

Código feito em CCS C Compiler

#include <16F877A.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for

#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#use delay(clock = 20MHz)

//============== TABELA COM VALORES DE UMA ONDA SENOIDAL ================//
const unsigned int seno[73] = { 0,0,1,2,3,5,7,9,12,14,18,21,25,29,33,37,41,
 45,50,54,58,62,66,70,74,78,81,85,87,90,92,94,
 96,97,98,99,99,99,98,97,96,94,92,90,87,85,81,
 78,74,70,66,62,58,54,50,45,41,37,33,29,25,21,
 18,14,12,9,7,5,3,2,1,0};
//======================================================================//

unsigned int8 ii = 0, ton;
#int_RTCC
void RTCC_isr(void){
   ii=ii+1; ton = seno[ii];
   set_pwm1_duty(ton);
   if(ii>71)ii=0;
}

void main(){
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);

   // Programação do Timer 0 - Overflow a cada 819 us
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_16);

   setup_timer_1(T1_DISABLED);

   // Programação do Timer 2 - usado no PWM
   setup_timer_2(T2_DIV_BY_1,99,1);

   setup_ccp1(CCP_PWM);
   set_pwm1_duty(99); // Ton = 100%
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);

   enable_interrupts(INT_RTCC);
   enable_interrupts(GLOBAL);

    while(true){
      /*
      ii=ii+1; ton = seno[ii];
      set_pwm1_duty(ton);
      if(ii>71)ii=0;
      delay_ms(1);
      */
   
   }
}















06/08/2022

Proporção

1- De cada 10 alunos de uma sala de aula, 6 são do sexo feminino. Sabendo que nesta sala de aula há 18 alunos do sexo feminino, quantos são do sexo masculino ?

Resolução:

6 / (10 - 6) = 18 / x
x = 12 alunos

2- Foram construídos 2 reservatórios de água, a razão entre os valores internos do 1° e do 2° é de 2 para 5, e a soma desses volumes é 14 . Qual é a diferença entre as capacidades desses 2 reservatórios ?

Resolução:

1° --> 2x
2° --> 5x

2x + 5x = 14            2 . 2 = 4
x = 2                        5 . 2 = 10

10 - 4 = 6 m³


3- Manoel vendeu seu carro por 27.000 R$ e teve um prejuízo de 10% sobre o valor de custo do total do veículo, qual o valor do carro ?

Resolução:

100 - 10 = 90%
27.000 ---> 100%
x ----------> 90%

x = 30.000 R$


4- Em um mapa cuja escala era de 1:15104, a menor distância entre dois pontos A e B, medida com a régua, era de 12 cm. Isso significa em real é igual a ?

Resolução:

1 ---> 15104
12 --> x

1 / 15104 = 0,12 / x

x  = 1812,48 m