Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
For questions pertaining to the Arduino microcontroller and it's integration with Raspberry Pi projects. Questions about Arduino only are off-topic and can be asked at Arduino Stack Exchange.
1
vote
How to read a long int via i2c?
On Arduino:
long n;
int req=0;
void sendData(){
if(req==0){
n = 300; //mockup
//n = readDistance();
}
Serial.print(n);
Serial.println(" xx");
Wire.write(n);
n = n>>8;
req = (req+ …
1
vote
Accepted
How to read a long int via i2c?
Code for the slave (Arduino):
void sendData(){
long n;
n = 300; //mockup
//n = readDistance();
Wire.write((const uint8_t*)&n, sizeof(long));
//Serial.print(n);
//Serial.println(" mm");
} …
2
votes
4
answers
8k
views
How to read a long int via i2c?
I tried to connect an Arduino Uno with my Raspberry using the i2c bus, with code and wiring suggested here. … This example is sending only one byte from RPi to Arduino and back, and everything works fine. …