Git Product home page Git Product logo

bussola's Introduction

Classe sobre o chip HMC5883L

  Bussola.h - Biblioteca com a Classe que define a bussola
  Author: André Eppinghaus
  Data: 04/09/2016
  Instrucoes: README.txt

Adaptacoes dos sites:

Adaptacoes : Arduino e Cia - http://www.arduinoecia.com.br/2014/09/sensor-gy-80-acelerometro-bussola-barometro.html

 Based largely on code by  Jim Lindblom
 Get pressure, altitude, and temperature from the BMP085.
 Serial.print it out at 9600 baud to serial monitor.

Modo de usar:

Instalação: 
Baixe as seguintes bibliotecas: 

https://github.com/manifestinteractive/arduino/tree/master/Libraries/HMC5883L

Programa de exemplo de uso para a utilização das bibliotecas Ambiente, Giroscopio e :


// Reference the I2C Library
#include <Wire.h>
// Reference the HMC5883L Compass Library
#include <HMC5883L.h>

// controle da bussola
#include <Bussola.h>

// controle do giroscopio
#include <Giroscopio.h>

// controle do ambiente
#include <Ambiente.h>

Bussola bussola;
Giroscopio giro;
Ambiente ambiente;

void setup()
{
    // Initialize the serial port.
  Serial.begin(9600);
  Wire.begin(); //necessrio para o funcionamnto da bussola
  ambiente.setup();
  
  giro.setup();//tem que ser primeiro
  bussola.setup();// tem que ser por ultimo pois esta fechando o Wire.h

   
}

void loop()
{
  
  // Chama a rotina que calcula a temperatura
  // Esta rotina DEVE ser executada primeiro
  float temperature = ambiente.bmp085GetTemperature(ambiente.bmp085ReadUT());
 
  Serial.print("Temperatura: ");
  // Mostra a temperatura com 2 casas decimais
  Serial.print(temperature, 2); 
  Serial.println(" C");
  
 /// Chama a rotina que calcula a pressao
  float pressure = ambiente.bmp085GetPressure(ambiente.bmp085ReadUP());
  // Chama a rotina que calcula atmosfera
  float atm = pressure / 101325; 
  // Chama a rotina que calcula a altitude
  float altitude = ambiente.calcAltitude(pressure); 
 

  Serial.print("Pressao: ");
  Serial.print(pressure, 0); 
  Serial.println(" Pa");

  Serial.print("Atmosfera padrao : ");
  // Mostra o valor com 4 casas decimais
  Serial.println(atm, 4); //display 4 decimal places

  Serial.print("Altitude: ");
  // Mostra o valor com 2 casas decimais
  Serial.print(altitude, 2); 
  Serial.println(" M");

  Serial.println();

  Serial.println();
  
 Serial.print(" Graus   \t"); //ok
 Serial.print(bussola.getGraus());//ok
 Serial.println();
 
 giro.getGyroValues(); //calcula os valores

 Serial.print("X:");
 Serial.print(giro.getX()); //pega eixo X

 Serial.print(" Y:"); 
 Serial.print(giro.getY()); //pega eixo Y

  Serial.print(" Z:");
  Serial.println(giro.getZ()); //pega eixo Z
  
 delay(3000);
  
}

bussola's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.