Converting numbers to binary and writing them through I2C

I'm building an audio control system with an Arduino and some other bits and pieces. One of the things I need to do is get a value between 0 and 255, convert it to binary, and write that through an I2C port to a digital pot. I can control the chip select part and everything leading up to getting the variable, but I don't know how to work with I2C.
I'm using the TPL0102 (datasheet: http://www.ti.com/lit/ds/symlink/tpl0102-100.pdf) and I need to write the vale to the memory (volatile is fine, but I'd prefer non- volatile) of the digi pot.
Can anyone help me with this?

One of the things I need to do is get a value between 0 and 255, convert it to binary, and write that through an I2C port to a digital pot

What do you mean by "convert it to binary"

Assuming you are reading values from something like an analog sensor, the values are already in binary.

int someTenBitValue = analogRead(somePin);
byte someEightBitValue = somTenBitValue >> 2;
Wire.beginTransmission(someAddress);
Wire.write(someEightBitValue);
Wire.endTransmission();

It's not being read from an analog sensor, it's going to be generated in the arduino by a series of button presses, then mapped to be in an eight bit range.

packocrayons:
It's not being read from an analog sensor, it's going to be generated in the arduino by a series of button presses, then mapped to be in an eight bit range.

So what's the problem?

The I2C, I've read the tutorials and I fail to grasp the concept, what's the second wire for?
Also, I need to write two values to the pots, it's a twin pot IC, so how do I send it two values, would I just write the two values right in? Ie wire.Write(255255)

Firstly, if the values you are on about are in "int" or "byte" variables, then they are already in binary form.

As for I²C, you need to know the protocol as defined in the datasheet for the device you are using. That will tell you how to set the different values.

I²C has 2 wires - one carries the data in a stream of HIGH and LOW signals. The second wire carries a clock signal that tells the other end of the wires when there is data on the first wire to read, or when it should write to the first wire.

Without this clock signal the remote end won't know when it should be reading data and when not. It's what's known as a "synchronous" serial protocol, because all reading and writing is "synchronised" to the clock signal.

Alright, thanks guys it's starting to make sense now. I should be able to get it working.

i have been working with tplo1o2 digital potentiometer for few days and i am finding it difficult to communicate with it using arduino uno. i have connected the i2c pins, power, gnd and address pins and i have tried many settings with the pot pins and i am unable to communicate using wire library in arduino. i am so doubtful on my hardware setup.

could anyone help me with this?

i am so doubtful on my hardware setup.

So am I. You provided no link(s) to the hardware, no schematic, no pictures, and no code.

could anyone help me with this?

Not without a lot more information.

I have connected as per description below,

Connected what? If the grounds are not connected, you have a one-hand-clapping situation. Better sound happens when you use both hands.

A little schematic (scan/photo of hand drawn one if needed) says more than a thousand words. How about the i2c lines? Other pins on the device (you mentioned address pins).

I have connected as per the description below

TPL0102 Arduino
VDD VDD(5v)
GND GND
A0,A1,A2 GND
SCL SCL
SDA SDA
HA 5v
LA GND

Code : Digital Potentiometer in Wire example given in arduino 1.6.9

#include <Wire.h>

void setup() {
 Wire.begin(); // join i2c bus (address optional for master)
 Serial.begin(9600);
}

byte val = 0;

void loop() {
 Wire.beginTransmission(0x50); // transmit to device address 0x50
 // device address is specified in datasheet
 Wire.write(byte(0x00));  // sends instruction byte
 Wire.write(val);  // sends potentiometer value byte
 Wire.endTransmission();  // stop transmitting

 val++;   // increment value
 if (val == 256) {  // if reached 255th position (max)
   val = 0;  // start over from lowest value 
 }
 
 delay(500);
}

We can find the voltage changing from 0v to 5v using a multimeter between WA and GND.