title: communicating state of a potentiometer with a second arduino board
body: <p>I am trying to get an arduino board to read the state of a potentiometer which is connected to a master arduino board, without connecting the potentiometer to the second board with physical cables</p>
  
  <p>I have tried using Wire.write and Wire.read to just transfer the one value.</p>
  
  <p>The master arduino code:</p>
  
  <pre><code>#include &lt;Wire.h&gt;
  const int dial = A0;
  int reading = 0;
  
  void setup() {
    pinMode(dial, INPUT);
    Wire.begin();
  }
  
  void loop() {
    reading = analogRead(dial);
    Wire.beginTransmission(9);
    Wire.write(reading);
    Wire.endTransmission();
  }
  </code></pre>
  
  <p>The slave arduino code:</p>
  
  <pre><code>#include &lt;Wire.h&gt;
  int reading = 0;
  
  void setup() {
    Wire.begin(9);
    Serial.begin(9600);
    Wire.onReceive(receiveEvent);
  }
  
  void receiveEvent(int bytes) {
    reading = Wire.read();
  }
  
  void loop() {
    Serial.println(reading);
  }
  </code></pre>
  
  <p>When I read the Serial Monitor, the potentiometer or "reading" in the slave arduino limits at 255 (I don't know why) in 6 intervals (goes from 0 to 255, then drops to 0 and does that 6 times). I expect it to do the full range of the potentiometer to cap out at 1023.</p>