Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

MCP23017 Test I2C Help without Toolbox

Netduino Plus 2 I2C MCP23017

  • Please log in to reply
1 reply to this topic

#1 Hunger89

Hunger89

    New Member

  • Members
  • Pip
  • 1 posts
  • LocationGermany

Posted 18 February 2014 - 08:51 PM

Hello,

 

I'm new and trying to understand my Nettduino.

I try to talk to the MCP23017. I get no result.

I want to understand how this I2C works.

 

 

This ist my Code.

namespace I2C_Test_MCP23017{    public class Program    {        public static void Main()        {            ushort MCP23017_addrese  = 0x40;            int busrate = 400;            byte[] WriteBufferFalse = {0x00} ;            byte[] WriteBufferTrue = { 0xFF};            byte[] addr = { 0x00};            I2CDevice.Configuration test_Config = new I2CDevice.Configuration(MCP23017_addrese, busrate);            I2CDevice Test = new I2CDevice(test_Config);            //Port false            I2CDevice.I2CTransaction[] writePortfalse = new I2CDevice.I2CTransaction[]            {                I2CDevice.CreateWriteTransaction(addr),                I2CDevice.CreateWriteTransaction(WriteBufferFalse)            };            I2CDevice.I2CTransaction[] writePortTrue = new I2CDevice.I2CTransaction[]            {                I2CDevice.CreateWriteTransaction(addr),                I2CDevice.CreateWriteTransaction(WriteBufferTrue)            };            while (true)            {                Test.Execute(writePortfalse, 1000);                Thread.Sleep(500);                Test.Execute(writePortTrue, 1000);                Thread.Sleep(500);                        }        }    }}


#2 sfugarino

sfugarino

    Member

  • Members
  • PipPip
  • 29 posts
  • LocationSuwanee, GA

Posted 27 February 2014 - 04:58 AM

Try putting pull up  resistors on scl and sda or put the following at the top of your code: OutputPort sda = new OutputPort(Pins.GPIO_PIN_SDA, true); sda.Write(false); sda.Dispose();





Also tagged with one or more of these keywords: Netduino Plus 2, I2C, MCP23017

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.