polewav.blogg.se

Due wire library
Due wire library





due wire library

Wire Library - Your reference for the Wire Library.ĭigitalPotentiometer - How to control an Analog Devices AD5171 Digital Potentiometer. Void changeAddress(byte oldAddress, byte newAddress)

due wire library

The following code changes the address of a Devantech Ultrasonic Range Finder (SRF10 or SRF08) I2C SRF10 or SRF08 Devantech Ultrasonic Ranger Finder // by Nicholas Zambetti // and James Tichenor // Demonstrates use of the Wire library reading data from the // Devantech Utrasonic Rangers SFR08 and SFR10 // Created 29 April 2006 // This example code is in the public domain. Instructions for re-addressing the range finders can be found at the bottom of the code below. If using two SRFxxs on the same line, you must ensure that they do not share the same address.For more circuit examples, see the Fritzing project page Schematic Power your SRFxx from 5V, with the addition of a 100uf capacitor in parallel with the range finder to smooth it's power supply. Hardware Requiredĭevantech SRFxx Range Finder (models SRF02, SRF08, or SRF10, click to compare)Īttach the SDA pin of your SRFxx to analog pin 4 of your board, and the SCL pin to analog pin 5. When this information is sent - bit after bit -, the called upon device executes the request and transmits it's data back - if required - to the board over the same line using the clock signal still generated by the Master on SCL as timing.īecause the I2C protocol allows for each enabled device to have it's own unique address, and as both master and slave devices to take turns communicating over a single line, it is possible for your Arduino to communicate with many devices (in turn) while using just two pins of your microcontroller. As the clock line changes from low to high (known as the rising edge of the clock pulse), a single bit of information - that will form in sequence the address of a specific device and a a command or data - is transferred from the board to the I2C device over the SDA line. The I2C protocol involves using two lines to send and receive data: a serial clock pin (SCL) that the Arduino Master board pulses at a regular interval, and a serial data pin (SDA) over which data is sent between the two devices. This example shows how to read a Devantech SRFxx, an ultra-sonic range finder which communicates via the I2C synchronous serial protocol, using Arduino's Wire Library.







Due wire library