Typically, when I connect my Arduino to a slave device through I2C or SPI, I'll control the slave using instructions coded in the firmware. The output data will be then printed to the Serial port and I'll use Python or MATLAB to read from the serial port and process the data later on.
PC <- Arduino <--> SlaveNow say I want to control the I2C slave from my computer, i.e. write instructions to the I2C slave. How do I go about it? I thought of writing to the Arduino Serial port, making Arduino read it and hence configuring it but this doesn't seem efficient and I have been racking my head over this for a while.
- why wouldn't that be efficient? You can put an interrupt on an incoming string.ratchet freak– ratchet freak2017-04-28 15:09:55 +00:00CommentedApr 28, 2017 at 15:09
- 2That use of an Arduino as a 'format converter' to a peripheral from a computer is 'efficient' in the sense that you can use what you have to hand, do it quickly, expect it to work, and debug it easily if it doesn't. It's not efficient in the sense that there's an extra computer in the way, but, who cares?Neil_UK– Neil_UK2017-04-28 15:33:35 +00:00CommentedApr 28, 2017 at 15:33
- Reading the comments I have to agree with you guys. I like the idea of using an interrupt. I'll definitely check on that and I think that is the solution I might be looking for.Mathews John– Mathews John2017-04-28 17:42:50 +00:00CommentedApr 28, 2017 at 17:42
- Welcome to Arduino SE. Be sure to take the tour to see how this works and to earn a badge:arduino.stackexchange.com/TourSDsolar– SDsolar2017-04-29 08:16:07 +00:00CommentedApr 29, 2017 at 8:16
- Have you looked into the pigpio library? Do a quick search, maybe?SDsolar– SDsolar2017-04-29 08:16:40 +00:00CommentedApr 29, 2017 at 8:16
1 Answer1
Since you are using an arduino as a partial bridge to a PC, it appears that you already have a solution in hand.
There is a project onGit that is intended to perform this function that you could use for reference. (Disclaimer -- I have not tested this code.)
The cheapest stand alone device that I found was a $15 breakout board fromAdafruit.
Explore related questions
See similar questions with these tags.
