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
// Pin 13 has an LED connected on most Arduino boards. | |
// give it a name: | |
int led[5] = {13,12,11,10,9}; | |
int btnLargada = 5; | |
bool largadaIniciada = false; |
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
// Pin 13 has an LED connected on most Arduino boards. | |
// give it a name: | |
int botao = 12; | |
int sensor = 8; | |
int motor1 = 5; | |
int motor2 = 6; | |
int estadoBotao = LOW; | |
int estadoBotaoAntigo = 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
const int botao = 12; | |
const int led = 8; | |
int estadoBotao = 0; | |
void setup() | |
{ | |
pinMode(led, OUTPUT); | |
pinMode(botao, INPUT); | |
} | |
void loop() | |
{ |
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
#include <Servo.h> | |
#define SERVO 9 | |
Servo s; | |
int pos; | |
// give it a name: | |
const int btn1 = 3; | |
const int btn2 = 4; | |
const int btn3 = 5; |
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
const int led_right = 8; | |
const int led_left = 9; | |
const int btn1 = 2; | |
const int btn2 = 3; | |
const long intervalo = 500; // intervalo para o led piscar | |
unsigned long millisAnterior = 0; // Armazena o último tempo para a próxima contagem | |
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
<?php | |
function calculaIRRF($salario) { | |
if($salario < 1903.98) { | |
$desconto = 0; | |
} | |
elseif($salario <= 2826.65){ | |
$desconto = 7.5; | |
} | |
elseif($salario <= 3751.5) { | |
$desconto = 15; |
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
<?php | |
$n = 10; | |
$fatorial = 0; | |
for($i = 0; $i <= 10; $i++) { | |
if($i == 0) { | |
$fatorial = 1; | |
} | |
else{ |
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
<?php | |
$fib = array(); | |
for($i = 0; $i < 10; $i++){ | |
if($i < 2){ | |
$fib[$i] = $i; | |
} else { | |
$fib[$i] = $fib[$i - 1] + $fib[$i-2]; | |
} | |
} |
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
<?php | |
$numero = 101; | |
if($numero % 2 == 0){ | |
// Nenhum número par, exceto 2 é primo | |
if($numero == 2){ | |
echo 'É um número primo'; | |
} | |
else{ | |
echo 'Não é um número primo'; |
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
<?php | |
$numero = 49; | |
if($numero % 2 == 0){ | |
echo "O número é par"; | |
} | |
else { | |
echo "O número é ímpar!"; | |
} |
NewerOlder