Arduino Development for OSX and iOS (2015)
5. Debugging Arduino Logic
5.4 Demo 2: I2C Communication
This demo is about I2C communication, https://www.arduino.cc/en/Reference/Wire . In this demo, I use Arduino Uno so you can connect
· A4 (SDA) Arduino to channel 1 Ikalogic
· A5 (SCL) Arduino to channel 2 Ikalogic
· GND Arduino to channel GND Ikalogic
On Arduino board, we write a program. Write this program and upload to Arduino board.
#include <Wire.h>
byte val = 0;
void setup()
{
Wire.begin();
}
void loop()
{
Wire.beginTransmission(78);
Wire.write(val);
val++;
Wire.write(val);
val++;
Wire.write(val);
Wire.endTransmission();
val++;
if(val == 80)
{
val = 0;
}
delay(10);
}
On ScanaStudio, we do the following configuration on Configure panel
· Trigger type : No trigger
· Sampling rate: 100 KHz
· N. of Samples: 248000
After configured, you can click Start button to retrieve inputs from Arduino board.
A sample output can be seen in Figure below.
Source Code
You can download source code on http://www.aguskurniawan.net/book/arosx_ios.zip .
Contact
If you have question related to this book, please contact me at aguskur@hotmail.com . My blog: http://blog.aguskurniawan.net