Skip to content

Instantly share code, notes, and snippets.

#include "AQM0802BigDigit.h"
//----- I2C interface -----
void AQM0802BigDigit::WriteCommand(uint8_t data)
{
Wire.beginTransmission(0x3E);
Wire.write(0x00);
Wire.write(data);
Wire.endTransmission(true);
}
@PiTshan
PiTshan / getTempHumPres.cpp
Created May 11, 2018 06:37
getting Temperature, humidity, pressure value from BME280
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "bme280Interface.cpp"
int main()
{
BME280Interface bme280;
if (bme280.measurement() == -1)
{
@PiTshan
PiTshan / bme280Interface.cpp
Created May 11, 2018 06:28
bme280Interface
#include<wiringPiI2C.h>
class BME280Interface
{
public:
static const int devID = 0x76;
private:
int fd;
static const unsigned char osrs_t = 1; //Temperature oversampling x 1
static const unsigned char osrs_p = 1; //Pressure oversampling x 1
@PiTshan
PiTshan / I2CsensorHUB.py
Last active October 1, 2015 09:38
RaspPi側のPythonスクリプト
#coding: utf-8
import smbus
import time
bus_number = 1
i2c_address = 0x72
bus = smbus.SMBus(bus_number)
@PiTshan
PiTshan / I2C_SensorHub.ino
Last active October 7, 2015 03:20
RaspPiとArduinoをI2C接続して、アナログセンサを最大4つ接続する
/*
* I2C SensorHub Ver1.0
* created 18 Sep. 2015
* function:
* communicate to AD converter(A0,A1,A2,and A3 port) on Aruduino UNO via I2C bus.
* based on SUMBus protocol (almost, uncertain)
* Editor : PiT
* 07 Oct. 2015 V1.1 A0_MSB,A0_LSB,..A3_MSB,A3_LSBをReadOnlyに変更
* 07 Oct. 2015 V1.0.1 コメント:レジスタマップの間違いを修正
* 01 Oct. 2015 V1.0 release