-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Codes - final
- Loading branch information
Showing
117 changed files
with
1,224 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#define potPin 1 // Define o pino analógico em que o potenciômetro vai ser conectado | ||
#define ledPin 3 // Define o pino que terá um LED e um resistência ligada ao terra | ||
|
||
int valPot = 0; //Variável que armazena o valor da leitura do potenciômetro | ||
|
||
void setup() { | ||
|
||
pinMode(ledPin,OUTPUT); // Configura o pino do LED como saída | ||
|
||
} | ||
|
||
void loop() { | ||
|
||
valPot = analogRead(potPin); //Faz a leitura analógica do pino em que o potenciômetro esta ligado | ||
valPot = map(valPot,0,1023,0,255); //Utilizando a função map() para transformar uma escala de 0-1023 em uma escala 0 a 255 | ||
analogWrite(ledPin,valPot ); // Aciona o LED proporcionalmente ao valor da leitura analógica | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
int timer = 100; // Quanto maior, mais devagar. | ||
int pins[] = { 3, 5, 6}; // vetor com o número dos pinos | ||
int num_pins = 3; // quantidade de LEDs (tamanho do vetor) | ||
|
||
void setup() | ||
{ | ||
int i; | ||
|
||
for (i = 0; i < num_pins; i++) // elementos do vetor vão de 0 a num_pins - 1 | ||
pinMode(pins[i], OUTPUT); // configurar cada pino como saída | ||
} | ||
|
||
void loop() | ||
{ | ||
int i; | ||
|
||
for (i = 0; i < num_pins; i++) { // varrer cada pino... | ||
digitalWrite(pins[i], HIGH); // ligando-o, | ||
delay(timer); // pausando-o, | ||
digitalWrite(pins[i], LOW); // e desligando-o. | ||
} | ||
for (i = num_pins - 1; i >= 0; i--) { | ||
digitalWrite(pins[i], HIGH); | ||
delay(timer); | ||
digitalWrite(pins[i], LOW); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//sinaleiro | ||
|
||
int verde = 3; | ||
int amarelo = 5; | ||
int vermelho = 6; | ||
|
||
|
||
void setup() { | ||
|
||
pinMode(verde, OUTPUT); | ||
pinMode(amarelo, OUTPUT); | ||
pinMode(vermelho, OUTPUT); | ||
} | ||
|
||
|
||
void loop() { | ||
digitalWrite(verde, HIGH); | ||
delay(2000); | ||
digitalWrite(verde, LOW); | ||
delay(2000); | ||
digitalWrite(amarelo, HIGH); | ||
delay(1000); | ||
digitalWrite(amarelo, LOW); | ||
delay(1000); | ||
digitalWrite(vermelho, HIGH); | ||
delay(2000); | ||
digitalWrite(vermelho, LOW); | ||
delay(2000); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
int verde = 5; | ||
int vrecebido = -2; | ||
int ldr = 0; | ||
int leitura; | ||
|
||
void setup() { | ||
pinMode(verde, OUTPUT); | ||
Serial.begin(9600); | ||
} | ||
|
||
void loop() { | ||
|
||
|
||
if (Serial.available() > 0) { | ||
vrecebido = Serial.read(); | ||
} | ||
|
||
if (vrecebido > 0) { | ||
if (vrecebido == '1'){ | ||
digitalWrite(verde, HIGH); | ||
//Serial.print(HIGH); | ||
delay(300); | ||
} else if (vrecebido == '0'){ | ||
digitalWrite(verde, LOW); | ||
//Serial.print(LOW); | ||
delay(300); | ||
} | ||
vrecebido = -2; | ||
} | ||
|
||
leitura = analogRead(ldr); | ||
//Serial.print(leitura); // o valor lido | ||
|
||
// alguns limiares para quantizar valores determinados | ||
if (leitura < 10) { | ||
Serial.println(" Brilhante"); // escuridão | ||
} else if (leitura < 700) { | ||
Serial.println(" Muito Claro"); // penumbra, entardecer | ||
} else if (leitura > 700 && leitura <950) { | ||
Serial.println(" Iluminado"); // | ||
} else if (leitura > 950) { | ||
Serial.println(" Muito Escuro"); // brilhante | ||
} | ||
|
||
delay(1000); | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
<?php | ||
|
||
//variavel para receber o valor | ||
$valor=$_GET['valor']; | ||
|
||
|
||
//condicao | ||
|
||
if($valor==0){ | ||
$port = fopen("COM3", "w"); //define a porta e o metodo a ser executado | ||
fwrite($port,0); //escreve | ||
fclose($port); //fecha a comunicaçao | ||
echo '<meta http-equiv="refresh" content="0;URL=../index.html">'; | ||
} | ||
|
||
if($valor==1){ | ||
$port = fopen("COM3", "w"); | ||
fwrite($port,1); | ||
fclose($port); | ||
echo '<meta http-equiv="refresh" content="0;URL=../index.html">'; | ||
} | ||
|
||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
// Conecta na porta | ||
$port = fopen('COM3', 'w+'); | ||
|
||
// Em alguns casos a Arduino pode reiniciar, por isso é bom esperar para enviar informação depois de conectar | ||
sleep(2); | ||
|
||
// Agora que a Arduino "Provavelmente já respondeu", pega o valor da resposta | ||
echo "<center>Luminosidade do Ambiente: ".fgets($port)."</center>"; | ||
|
||
// Fecha a conexão com a porta | ||
fclose($port); | ||
|
||
//atualiza informacao | ||
|
||
|
||
?> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="refresh" content="15" >; | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Controle de Iluminação </title> | ||
<link rel="stylesheet" href="../themes/lampada.min.css" /> | ||
<link rel="stylesheet" href="../themes/jquery.mobile.icons.min.css" /> | ||
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile.structure-1.4.5.min.css" /> | ||
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | ||
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> | ||
</head> | ||
<body> | ||
<div data-role="page" data-theme="b"> | ||
<div data-role="header" data-position="inline"> | ||
<h1 align="center"><img src="../images/logo.png" style="width:50%; height:auto"></h1> | ||
</div> | ||
<div data-role="content" data-theme="a"> | ||
|
||
<table data-role="table" id="table-column-toggle" data-mode="column" class="ui-responsive table-stroke"> | ||
|
||
|
||
<tr> | ||
<td align="center"><a href="#" data-role="button" data-icon="" target="_parent"><img src="../images/ler.png"/> | ||
<br>Luminosidade<br> | ||
|
||
<br></a> </td> | ||
</tr> | ||
|
||
<tr> | ||
<td align="center"> | ||
|
||
<?php include "leitura.php" ?> | ||
|
||
</td> | ||
</tr> | ||
|
||
|
||
</table> | ||
|
||
</div> | ||
</div> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Arduino Automação</title> | ||
<link rel="stylesheet" href="themes/lampada.min.css" /> | ||
<link rel="stylesheet" href="themes/jquery.mobile.icons.min.css" /> | ||
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile.structure-1.4.5.min.css" /> | ||
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> | ||
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> | ||
</head> | ||
<body> | ||
<div data-role="page" data-theme="b"> | ||
<div data-role="header" data-position="inline"> | ||
<h1 align="center"><img src="images/logo.png" style="width:50%; height:auto"></h1> | ||
</div> | ||
<div data-role="content" data-theme="a"> | ||
|
||
<table data-role="table" id="table-column-toggle" data-mode="column" class="ui-responsive table-stroke"> | ||
|
||
<tr> | ||
<td align="center"><p align="center"><strong>Selecione uma opção!</strong></p></td> | ||
</tr> | ||
|
||
<tr> | ||
<td align="center"><a href="controller/controle.php?valor=1" data-role="button" data-icon="" target="_parent"><img src="images/on.png"/><br>Ligar</a> </td> | ||
</tr> | ||
|
||
<tr> | ||
<td align="center"><a href="controller/controle.php?valor=0" data-role="button" data-icon="" target="_parent"><img src="images/off.png"/><br>Desligar</a> </td> | ||
</tr> | ||
|
||
<tr> | ||
<td align="center"><a href="controller/read.php" data-role="button" data-icon="" target="_parent"><img src="images/ler.png"/><br>Leitura</a> </td> | ||
</tr> | ||
|
||
|
||
</table> | ||
|
||
</div> | ||
</div> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.