Skip to content

Instantly share code, notes, and snippets.

@microcontrollershub
Created March 9, 2018 02:40
Show Gist options
  • Save microcontrollershub/445e676140e2cc844a0253e369d56187 to your computer and use it in GitHub Desktop.
Save microcontrollershub/445e676140e2cc844a0253e369d56187 to your computer and use it in GitHub Desktop.
// Arduino as Master Code
// by Varad Kulkarni <http://www.microcontrollershub.com>
// Created 08 March 2018
#include <Wire.h>
void setup()
{
Wire.begin(); // Initialize Arduino as Master
}
void loop()
{
Wire.beginTransmission(0x40); // Transmit to device #0x40
Wire.write('0'); // Sends one byte as '0'
Wire.endTransmission(); // End transmition
delay(2000);
Wire.beginTransmission(0x40); // Transmit to device #0x40
Wire.write('1'); // Sends one byte as '1'
Wire.endTransmission(); // End transmition
delay(2000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment