Beispiel #1
0
        private static void I2CWrite(byte address, byte data)
        {
            byte[] Write_buffer = new byte[2] {
                address, data
            };

            softwareI2C.Write(DEVICE_ADDR, Write_buffer);
            //i2cBus2.Write(write_buffer, 1000);
        }
Beispiel #2
0
        // Note: A constructor summary is auto-generated by the doc builder.
        /// <summary></summary>
        /// <param name="socketNumber">The socket that this module is plugged in to.</param>
        public ColorSense(int socketNumber)
        {
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);

            socket.EnsureTypeIsSupported(new char[] { 'X', 'Y' }, this);

            LEDControl = new GTI.DigitalOutput(socket, Socket.Pin.Three, false, this);

            softwareI2C = new GTI.SoftwareI2C(socket, Socket.Pin.Five, Socket.Pin.Four, this);

            // Send COMMAND to access control register for chip power-up
            // Send to power-up chip
            softwareI2C.Write(colorAddress, new byte[] { 0x80, 0x03 });
        }