Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include "../pigpio.h"
- #include <unistd.h>
- #include <iostream>
- /* Leer datos del sensor usando I2C
- *
- */
- int main(void) {
- typedef int *Acc; // Defino un handle (Apuntador) // not sure about this one
- gpioInitialise(); // inicializa la libreria
- if (gpioInitialise() <=0)
- {
- std::cout << "gpio not initialise";
- return 0;
- }
- else
- {
- std::cout << "gpio working fine" << std::endl;
- }
- //i2cOpen(0,0x3B,0); habro el i2c y leeo la informacion en la direccion 0x3b
- //i2cOpen(Bus seleccionado, Direccion sensor, Flag debe ser 0)
- //Acc i2cOpen(0,0x3B,0);
- for (;;)
- {
- std::cout << "Valor de 0x3B: "<< i2cReadByte (i2cOpen(0,0x3B,0)) << std::endl; // Leeo informacion del bus, menos codigo
- }
- gpioTerminate();
- return 0;
- }
Add Comment
Please, Sign In to add comment