Comments (9)
I too am having an issue working with I2C/Remote-Arduino. I'm using an HDC100x temp sensor, and can read the Device ID (0x1000) using the native Arduino Wire library commands. However, when using the I2C event/callback functionality, I receive no response except for 0s.
To verify, I am having the callback function called, but no data is received using the DataReader variable.
I'm not sure if I'm doing it correctly, but here's the code I'm using:
arduino.pinMode(20, PinMode.I2C);
arduino.pinMode(21, PinMode.I2C);
arduino.I2c.enable();
arduino.I2c.I2cReplyEvent += getData;
arduino.I2c.beginTransmission(0x40);
arduino.I2c.write(0xff);
arduino.I2c.endTransmission();
arduino.I2c.requestFrom(0x40, 2);
private void getData(byte myAdd, byte myReg, Windows.Storage.Streams.DataReader myRep)
{
var ignored = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
textBox.Text = "Received: ";
byte[] myVals = new byte[2];
myRep.ReadBytes(myVals);
foreach (byte i in myVals)
{
textBox.Text += i;
}
});
}
I've tried putting the data gathering inside and out of async functions without any change. I've also tried changing how the data is gotten from the myRep variable. I'm guessing I might be missing something fundamental, but maybe someone can offer some additional guidance.
from remote-wiring.
OK, got it working with the UNO. Perhaps I was having problems because I was trying to use the DUE and it's not quite fully supported? Not sure, but I still receive zeros on the Due, and the Uno is still a little finicky, though I can receive the correct response.
I had to issue two requestFrom statements, but also needed to request more bytes than I actually needed to read out the register from my device. For instance, when checking the ID, I only actually needed to request 2 bytes to verify reading was correct. Instead, I used a request for 18 bytes, twice. This allowed me to click a button, and get the correct response from the register that had the device ID. Without putting two identical requestFrom statements, I had to click the read button (That I programmed) multiple times before the correct response was obtained.
I went back and tried this with the Due, but it still only gave me zeros. I also tried on the SDA/SCL(1) pins on the Due, with no difference in outcome.
So, perhaps a timing issue, or maybe something else, but there's at least one way to get it to work (On the Uno). I think the Due Firmata might be problematic. Other functionality does work on the Due, but not the I2C from what I can see.
Hope this makes sense. Let me know if you still have problems.
from remote-wiring.
Ideally you would use remote-wiring to create a virtual instance of your Arduino and send the I2C transactions in the standard Arduino format.
from remote-wiring.
I wasn’t aware of an remote-wiring instance version of Wire.read. I believe it used to show up, but no longer does.
For example, if I have an instance of remote-wiring called ‘arduino’, I can’t make a call to arduino.I2c.read() as I would make a call to wire.read() in Arduino.
Is there something similar? Are you guys aware that the callback doesn’t specify the register upon reading it after a response? Or am I just doing something wrong?
I even tried using a firmata call (Using .getRegister()), but still don’t see anything in the reg variable except for 0.
From: Zachary J. Fields [mailto:[email protected]]
Sent: Tuesday, May 17, 2016 9:00 PM
To: ms-iot/remote-wiring [email protected]
Cc: Jason A. Hegedus [email protected]; Mention [email protected]
Subject: Re: [ms-iot/remote-wiring] How to use I2C functionality (#93)
Ideally you would use remote-wiring to create a virtual instance of your Arduino and send the I2C transactions in the standard Arduino format.
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHubhttps://github.com//issues/93#issuecomment-219897607
from remote-wiring.
@turkycat wrote the i2c functionality, so he is the best to answer your question. I'm on vacation, but if we don't hear from him before I get back, then I'll try and work out an answer for you.
from remote-wiring.
Yes this is pretty much where I'm coming undone, the only details or examples I've seen reference methods that either no longer exist or are used in a different way. I did find some fairly helpful bit here: https://channel9.msdn.com/Events/Ignite/Australia-2015/MOB222 and here: https://github.com/mitchdenny/msftignite2015au-mob222.
from remote-wiring.
Hi Jesse,
Could you please take a look at this issue?
Sincerely,
IoTGirl
from remote-wiring.
I've solved in this mode (I don't know how) :
// in my case I used a buffer with 16 bytes array
private async void ButtonI2CReceive_OnClick(object sender, RoutedEventArgs e)
{
arduino.I2c.enable();
arduino.I2c.requestFrom(9, 16);
await Task.Delay(10);
arduino.I2c.requestFrom(9, 16);
}
I receive only one event on trigger it.
from remote-wiring.
If this issue is still relevant, please file this at: https://github.com/MicrosoftDocs/windows-iotcore-docs
from remote-wiring.
Related Issues (20)
- "AnalogWrite" with incremental delay after using "sendSysex" HOT 3
- CPU core is fully utilized after calling Firmate.begin() HOT 1
- Xamarin Support HOT 1
- Multiple Arduinos (RemoteDevices) HOT 2
- Arduino Mega not working with WRAE HOT 5
- Win 10 suppport HOT 1
- remote-wiring in not compatible with Arduino Mega HOT 2
- RfcommDeviceService null exception HOT 1
- Could not install package 'Windows-Remote-Arduino 1.4.0 HOT 4
- Analog Write Doesn't work in v1.4 HOT 2
- Raspberry PI 3 HOT 1
- AnalogRead error HOT 2
- DHT11 + Arduino UNO + Raspberry pi 3 + Win10iotCore HOT 1
- Code issue
- UsbSerial apparently doesn't connect to my Arduino Uno HOT 1
- c++/winrt support? HOT 1
- Microsoft.Maker.Serial is empty HOT 1
- StringMessageReceived event not always firing HOT 2
- IS this working forVIsual Studio HOT 1
- Bluetooth problem between Arduino device and laptop. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from remote-wiring.