i2c

i2c smbus filter function corrupting variables

馋奶兔 提交于 2019-12-13 04:06:50
问题 I have a simple function #define AMB_FILTER 0.7f int32_t fValue; (this is declared in the class header) int32_t Ambient::filter(uint32_t raw) { // If we have no preliminary fValue we don't need to calculate a filter if(fValue == -1) { fValue = raw; return fValue; } float y, yy; y = (1.0f - AMB_FILTER) * (float) raw; yy = AMB_FILTER * (float) fValue; fValue = (int32_t) (y + yy); printf("filter raw %d y %f yy %f fValue %d\n",raw, y, yy, fValue); return fValue; } It takes in a value that was

“Looking for connected device” Error when interfacing via I2C to BBB

大憨熊 提交于 2019-12-13 02:14:35
问题 I am trying to print a message to an OLED screen, everytime a button is pushed. Whenever I try running the code, I receive this "error". Im not sure what is causing it, or how I can resolve it. Any help would be appreciated. var b = require('bonescript'); var button = "P8_12"; b.pinMode(button, b.INPUT); var five = require('johnny-five'); var board = new five.Board(); var oled = require('oled-js'); var font = require('oled-font-5x7'); b.attachInterrupt(button, true, b.CHANGE, printTime)

Raspberry Pi i2c Read/Write Error

喜欢而已 提交于 2019-12-12 11:34:15
问题 Like many people, I've had a Pi for a while but never really done anything with it. I've finally got round to hooking up an MPU6050 IMU to play around with. It uses i2c for communication so I followed the guide by Adafruit regarding enabling i2c shown here Adafruit i2c. I then hooked up the MPU6050 to the i2c bus, and using i2cdetect -y 1 I was able to see a device at 0x68. However, when trying to read or write from the device I got a permission denied error, so I followed this post to solve

How i write multiple float data to Arduino from Rpi as master via i2c?

余生颓废 提交于 2019-12-12 04:39:12
问题 I read many post how Rpi receives float data via Arduino via i2c, with Rpi as master. But i need write floats values to arduino and i don't found any example. I want to use python smbus. Any one have a example? Thanks a lot! 回答1: After many tests, i can exchange multiple data between arduino as slave and Raspberry pi3 as master. Arduino code: #include <Wire.h> byte data[12]; int command; typedef struct processData{ float temp1; float temp2; float temp3; float temp4; float vazao_quente; float

Raspberry Pi to Arduino Communication

夙愿已清 提交于 2019-12-12 04:04:05
问题 I am using an opencv algorithm on my Raspberry pi 3. I need to output the data from the raspberry pi to my Arduino. Presently I am using serial, where I simply plug in the arduino to the raspberry pi using the USB connector. But my application requires a faster speed. I thought of exploring i2c communication. It is for a robotic application for which the input sensor values needs to be fast for the robot to respond quickly. Assuming the constraint that I need to push the values to a arduino

Read EEPROM entry from linux module

筅森魡賤 提交于 2019-12-12 03:49:45
问题 I'm writing a linux driver for a custom RF board. The RF board have an EEPROM contain some information and I want to load this information to my driver. Linux kernel already has EEPROM module, this module read all memory of the EEPROM and export to userspace by sysfs. Can I read this sysfs to get EEPROM's memory? If not, how can I get this information? Thank you. 回答1: There are userspace applications which read the data exported by the eeprom module. So if you know Perl a bit, I suggest that

Using the i2c smartdrive sensor with a Pio Cli commands to run motors

戏子无情 提交于 2019-12-11 07:21:47
问题 This is my i2c sensor: http://www.mindsensors.com/rpi/76-smartdrive-high-current-motor-controller look in pdf in Documents sessions please Based on this google guide https://developer.android.com/things/sdk/pio/pio-cli.html What I need to put in XX ZZ YY UU to run motors in determined speed, direction, duration, etc... e.g.: pio i2c I2C1 0x1B write-reg-buffer 0xXX 0xYY 0xUU 0xZZ As (in this case) I will use writeRegBuffer() on my android things app to run one, two or both motors in determined

Global variable arduino

我的未来我决定 提交于 2019-12-11 04:39:10
问题 I'm using I2C to communicate a Master Arduino to 4 Slaves Arduinos, and an Shield (OULIMEX Shield LCD 16x2) on every Arduino slave. I send Data from the master to slaves using I2C. So I use this code in the master : #include <Wire.h> #include <math.h> #include <floatToString.h> double incomingData; void setup() { Wire.begin(); Serial.begin(9600); incomingData = Serial.parseFloat(); //read incoming data } void loop() { delay (1000); if (Serial.available()) { incomingData = Serial.parseFloat();

Writing and reading from a virtual i2c using C++ and i2c-tools

孤者浪人 提交于 2019-12-11 00:21:34
问题 I am trying to write and read from the I2C bus using C++. My I2C bus is virtual and the first thing is to load the kernel module i2c_stub. I can do everything through bash and now I am porting it to C++. I can open the i2c bus, acquire the i2c bus with a specific address, but I cannot write and read. I am virtualizing /dev/i2c-3 . These are the commands if I do in bash: sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) clean sudo make -C /lib/modules/$(uname -r)/build M=$(pwd) modules sudo

How to convert the value get from Temperature Sensor?

冷暖自知 提交于 2019-12-10 20:41:20
问题 I am working on ST Temperature sensor( hts221 ) , I use I2C command communication with sensor. I see from the document like the following text. enter code here Temperature data are expressed as TEMP_OUT_H & TEMP_OUT_L as 2’s complement numbers. And the following picture is the description from document. And the Temperature data read from the sensor is like the following TEMP_OUT_L is 0xA8 TEMP_OUT_H is 0xFF How to convert the value of TEMP_OUT_L and TEMP_OUT_H to the Temperature data ? Thanks