manual de aplicações praticas para o arduino

8
MANUAL DE APLICAÇÕES PRÁTICAS PARA O ARDUINO Testes com: - Botão - Campainha - LDR - Potenciômetro - Sensor de Temperatura - Reed Swicth - Rele EMPRETEC EMPREENDIMENTOS TECNOLÓGICOS LTDA Rua Nicola Avalone, 8-67 Vila Quaggio CEP 17060-600 Bauru-SP - tel.: (14) 3212-2270 www.empretecnet.com.br

Upload: iago-cavalcante

Post on 27-Apr-2015

233 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Manual de aplicações praticas para o Arduino

MANUAL DEAPLICAÇÕES

PRÁTICAS PARA OARDUINO

Testes com:- Botão- Campainha- LDR- Potenciômetro- Sensor de Temperatura- Reed Swicth- Rele

EMPRETEC EMPREENDIMENTOS TECNOLÓGICOS LTDARua Nicola Avalone, 8-67 Vila Quaggio CEP 17060-600 Bauru-SP

- tel.: (14) 3212-2270www.empretecnet.com.br

Page 2: Manual de aplicações praticas para o Arduino

EXEMPLO 1 - TESTE COM BOTÃO

const int BOT = 12;

void setup() {pinMode (BOT , INPUT );Serial.begin(9600);

}

void loop() {int Leitura = digitalRead(BOT);Serial.print("Estado do Botão = ");Serial.println(Leitura,DEC);delay(150);}

Page 3: Manual de aplicações praticas para o Arduino

EXEMPLO 2 - TESTE COMCAMPAINHA

const int BUZZER = 13;

void setup() {pinMode ( BUZZER , OUTPUT );

}

void loop() {for(int i=0;i<3;i++){digitalWrite(BUZZER,HIGH);delay(300);digitalWrite(BUZZER,LOW);delay(300);

}delay(1200);

}

Page 4: Manual de aplicações praticas para o Arduino

EXEMPLO 3 - TESTE COM LDR

const int LDR = A0;int lum = 0;

void setup() {pinMode ( LDR , INPUT );Serial.begin(9600);

}

void loop() {lum=map(analogRead(LDR) , 0 , 1023 , 0 , 100);Serial.print("Luminosidade = " );Serial.println(lum);delay(200);

}

Page 5: Manual de aplicações praticas para o Arduino

EXEMPLO 4 - TESTE COMPOTENCIÔMETRO

const int POT = A0;int PosPot = 0;

void setup() {pinMode ( POT , INPUT );Serial.begin(9600);

}

void loop() {PosPot=map(analogRead(POT) , 0 , 1023 , 0 , 270);Serial.print("Posicao = " );Serial.print(PosPot);Serial.println(" graus.");delay(200);

}

Page 6: Manual de aplicações praticas para o Arduino

EXEMPLO 5 - TESTE COM SENSOR DETEMPERATURA LM35DZ

const int LM35 = A0;int Temperatura =0;

void setup() {pinMode ( LM35 , INPUT );Serial.begin(9600);

}

void loop() {Temperatura = analogRead(LM35);Temperatura = (5.0 * Temperatura * 100.0)/1024.0;Serial.print("Temperatura = ");Serial.println(Temperatura,DEC);delay(150);

}

Page 7: Manual de aplicações praticas para o Arduino

EXEMPLO 6 - TESTE COM REEDSWITCH

const int REED = 12;

void setup() {pinMode (REED , INPUT );Serial.begin(9600);

}

void loop() {int Leitura = digitalRead(REED);Serial.print("Estado do REED = ");Serial.println(Leitura,DEC);delay(150);}

Page 8: Manual de aplicações praticas para o Arduino

EXEMPLO 7 - TESTE COM RELE

const int RELE = 13;

void setup() {pinMode ( RELE , OUTPUT );

}

void loop() {digitalWrite(RELE,HIGH);delay(800);digitalWrite(RELE,LOW);delay(800);

}