Go Down

Topic: Addressing 23017/4051 using I2C Serial Interface & PROGMEM (Read 12114 times) previous topic - next topic

Pitchoilcan

#60
May 17, 2012, 04:29 pm Last Edit: May 19, 2012, 08:15 pm by Pitchoilcan Reason: 1
01010101 // Binary Bits
POR/RST value;1111 1111 //HEX 00 BANK A | POR/RST values; 1111 1111 //HEX 01 BANK B
POR/RST values; 0000 0000 //IOCON=0 HEX 0A 0B  

Resgister addresses
IODIR (0x00) //input/output Direction
IPOL (0x01) //gpio polarity, [switch]
GPINTEN (0x02)
DEFVAL (0x03)
INTCON (0x04)  //config (8 or 16 bit), 1 or 0 [font=Verdana]Active HIGH/Active LOW[/font]   Toggles INTPOL (output/input) operator/CONTROL bit.  [font=Verdana]Set to 0.[/font] 1 is DEFAULT.[font=Verdana] [?? 0x40 ??][/font]
IOCON (0x05) //Expander conifg (bits 0-7 01010101)[font=Verdana] [SEQOP disabled: 5th bit, BANK set to 0: 7th bit, ODR set to Active Driver Output: 2nd bit, MIRROR INT Pin NOT connected: 6th bit.][/font]
GPPU (0x06) //gpio pullup config
INTF (0x07)
INTCAP (0x08)
GPIO (0x09) //gpio port
OLAT (0x0A) // *output latch*
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pitchoilcan

#61
May 17, 2012, 10:16 pm Last Edit: May 20, 2012, 12:23 am by Pitchoilcan Reason: 1
Switching from the default (SEQOP) mode to gpio mode:
Quote
INTCON (0x04)  //config (8 or 16 bit), 1 or 0 Active HIGH/Active LOW   Toggles INTPOL (output/input) operator/CONTROL bit.  Set to 0. 1 is DEFAULT.
IOCON (0x05) //Expander conifg (bits 0-7 01010101) [SEQOP disabled: 5th bit, BANK set to 0: 7th bit, ODR set to Active Driver Output: 2nd bit, MIRROR INT Pin NOT connected: 6th bit.]

[font=Verdana]toggling [BankA/B] register polarity[/font][/b]
Quote
1.5
GPIO Port
Reading the GPIOn register reads the value on the
port. Reading the OLATn register only reads the
latches, not the actual value on the port.
The GPIO module is a general purpose, 16-bit wide,
bidirectional port that is functionally split into two 8-bit
wide ports.
Writing to the GPIOn register actually causes a write to
the latches (OLATn). Writing to the OLATn register
forces the associated output drivers to drive to the level
in OLATn. Pins configured as inputs turn off the
associated output driver and put it in high-impedance.
The GPIO module contains the data ports (GPIOn),
internal pull-up resistors and the output latches
(OLATn).

Quote
1.6.11
OUTPUT LATCH REGISTER (OLAT)
The OLAT register provides access to the output
latches. A read from this register results in a read of the
OLAT and not the port itself. A write to this register
modifies the output latches that modifies the pins
configured as outputs.
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pitchoilcan

#62
May 19, 2012, 01:08 am Last Edit: May 20, 2012, 04:33 pm by Pitchoilcan Reason: 1
IOCON.SEQOP 0;
Quote
On power up the device may be configured by sequentially writing to all of the register

Quote
remap registers using

IOCON.BANK
http://dkc1.digikey.com/us/en/tod/Microchip/GPIOExpanders/GPIOExpanders.html
0x00//adafruit library uses this format //ALL OFF
0000 0000 0000 0000 //centipede library uses this format //ALL OFF
0xFF //ALL ON
1111 1111 1111 1111
0101 0101 //ALTERNATE ON/OFF
[font=Verdana]0101 0101 0101 0101 //to Initialize (ledBits) (myInstance)[/font][/b]
1010 1010  //8bit
1010 1010 1010 1010 //16-bit
==================
IOCON = 01010101;
Quote
CS.portMode(0, 0b0000000000000000);
The b suffix for byte will only work with 8 bit values. Please use hex when you want to specify a bit pattern.

Quote
when in 16-Bit mode the address pointer is turned off, the addresses pointer actually points to the two paired registers in a ping-pong manner. For example the address will alternate between GPIOA and GPIOB if reading the port.
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pitchoilcan

write to GPIO Expander port register
read OLAT register
=====
Set IOCON:
01101010 //Default (8bitMode)
01010101 // myInstance (16bitMode)
===========
IOCON (0x05)
10101010 1010100 // initialize GPIO Mode
Quote
On power up the device may be configured by sequentially writing to all of the register

http://dkc1.digikey.com/us/en/tod/Microchip/GPIOExpanders/GPIOExpanders.html
01100110 0110011  // default mode
Quote
So now we are in void loop()  or a function of your own creation and want to control some output pins. To control bank A, we use:

 Wire.beginTransmission(0x20);
 Wire.send(0x12); // address bank A
 Wire.send(??);  // value to send
 Wire.endTransmission();
… replacing ?? with the binary or equivalent hexadecimal or decimal value to send to the register. To calculate the required number, consider each I/O pin from 7 to 0 matches one bit of a binary number - 1 for on, 0 for off. So you can insert a binary number representing the output levels. Or if binary does your head in, convert it to hexadecimal. So for example, you want pins 7 and 1 on. In binary that would be 10000010, in hexadecimal that is 0×82, or 130 decimal. (Using decimals is convenient if you want to display values from an incrementing value or function result).
[pic here]
If you had some LEDs via resistors connected to the outputs, you would have this as a result of sending 0×82:
[pic here]
Now if you want to address all the outputs at once, just send the byte for bank B after bank A. For example, we want bank A to be 11001100 and bank B to be 10001000 - so we send the following:

 Wire.beginTransmission(0x20);
 Wire.send(0xCC); // address bank A
 Wire.send(0x88); // address bank B
 Wire.endTransmission();

http://tronixstuff.wordpress.com/2011/08/26/tutorial-maximising-your-arduinos-io-ports/
[font=Verdana]=========
1st Octave
0x00-0xBB[/font]

full range
00h-15h
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pitchoilcan

#64
May 19, 2012, 04:47 pm Last Edit: May 19, 2012, 08:07 pm by Pitchoilcan Reason: 1
Code: [Select]
////////////////////////////////////////////////////////////////////////////////

void Adafruit_MCP23017::begin(uint8_t addr) {
 if (addr > 7) {
   addr = 7;
 }
 i2caddr = addr;

 Wire.begin();

 
 // set defaults!
 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
 wiresend(MCP23017_IODIRA);
 wiresend(0xFF);  // all inputs on port A
 Wire.endTransmission();

 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
 wiresend(MCP23017_IODIRB);
 wiresend(0xFF);  // all inputs on port B
 Wire.endTransmission();
}


void Adafruit_MCP23017::begin(void) {
 begin(0);
}

void Adafruit_MCP23017::pinMode(uint8_t p, uint8_t d) {
 uint8_t iodir;
 uint8_t iodiraddr;

 // only 16 bits!
 if (p > 15)
   return;

 if (p < 8)
   iodiraddr = MCP23017_IODIRA;
 else {
   iodiraddr = MCP23017_IODIRB;
   p -= 8;
 }

 // read the current IODIR
 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
 wiresend(iodiraddr);
 Wire.endTransmission();
 
 Wire.requestFrom(MCP23017_ADDRESS | i2caddr, 1);
 iodir = wirerecv();

 // set the pin and direction
 if (d == INPUT) {
   iodir |= 1 << p;
 } else {
   iodir &= ~(1 << p);
 }

 // write the new IODIR
 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
 wiresend(iodiraddr);
 wiresend(iodir);
 Wire.endTransmission();
}

uint16_t Adafruit_MCP23017::readGPIOAB() {
 uint16_t ba = 0;
 uint8_t a;

 // read the current GPIO output latches
 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
 wiresend(MCP23017_GPIOA);
 Wire.endTransmission();
 
 Wire.requestFrom(MCP23017_ADDRESS | i2caddr, 2);
 a = wirerecv();
 ba = wirerecv();
 ba <<= 8;
 ba |= a;

 return ba;
}

void Adafruit_MCP23017::writeGPIOAB(uint16_t ba) {
 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
 wiresend(MCP23017_GPIOA);
 wiresend(ba & 0xFF);
 wiresend(ba >> 8);
 Wire.endTransmission();
}

void Adafruit_MCP23017::digitalWrite(uint8_t p, uint8_t d) {
 uint8_t gpio;
 uint8_t gpioaddr, olataddr;

 // only 16 bits!
 if (p > 15)
   return;

 if (p < 8) {
   olataddr = MCP23017_OLATA;
   gpioaddr = MCP23017_GPIOA;
 } else {
   olataddr = MCP23017_OLATB;
   gpioaddr = MCP23017_GPIOB;
   p -= 8;
 }

 // read the current GPIO output latches
 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
 wiresend(olataddr);
 Wire.endTransmission();
 
 Wire.requestFrom(MCP23017_ADDRESS | i2caddr, 1);
  gpio = wirerecv();

 // set the pin and direction
 if (d == HIGH) {
   gpio |= 1 << p;
 } else {
   gpio &= ~(1 << p);
 }

 // write the new GPIO
 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
 wiresend(gpioaddr);
 wiresend(gpio);
 Wire.endTransmission();
}

void Adafruit_MCP23017::pullUp(uint8_t p, uint8_t d) {
 uint8_t gppu;
 uint8_t gppuaddr;

 // only 16 bits!
 if (p > 15)
   return;

 if (p < 8)
   gppuaddr = MCP23017_GPPUA;
 else {
   gppuaddr = MCP23017_GPPUB;
   p -= 8;
 }


 // read the current pullup resistor set
 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
 wiresend(gppuaddr);
 Wire.endTransmission();
 
 Wire.requestFrom(MCP23017_ADDRESS | i2caddr, 1);
 gppu = wirerecv();

 // set the pin and direction
 if (d == HIGH) {
   gppu |= 1 << p;
 } else {
   gppu &= ~(1 << p);
 }

 // write the new GPIO
 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
 wiresend(gppuaddr);
 wiresend(gppu);
 Wire.endTransmission();
}

uint8_t Adafruit_MCP23017::digitalRead(uint8_t p) {
 uint8_t gpioaddr;

 // only 16 bits!
 if (p > 15)
   return 0;

 if (p < 8)
   gpioaddr = MCP23017_GPIOA;
 else {
   gpioaddr = MCP23017_GPIOB;
   p -= 8;
 }

 // read the current GPIO
 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
 wiresend(gpioaddr);
 Wire.endTransmission();
 
 Wire.requestFrom(MCP23017_ADDRESS | i2caddr, 1);
 return (wirerecv() >> p) & 0x1;
}

[font=Verdana]  wiresend(iodiraddr);
 wiresend(iodir);[/font]


// only 16 bits!
 if (p > 15)
   return;

 if (p < 8) {
   olataddr = MCP23017_OLATA;
   gpioaddr = MCP23017_GPIOA;
 } else {
   olataddr = MCP23017_OLATB;
   gpioaddr = MCP23017_GPIOB;
   p -= 8;
 }
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pitchoilcan

#65
May 19, 2012, 05:28 pm Last Edit: May 19, 2012, 09:09 pm by Pitchoilcan Reason: 1
........pondering......Does the MCP23017 have internal pull up resistors?.
Quote
Now what appears not to work for you is the port write command. So take the working sketch and change the bit that outputs the LEDs to use the port write, can you get that to work? If not find out why, read the library instructions, look at the examples and see what you need to make it work. Then when you have got to a situation where all 16 bits of an integer can be output in one port write command, only then look to incorporate it into your drum code.
The secrete is to take simple small steps one at a time, and see each step working before moving on to the next. Keep getting closer and closer to what you want to happen. Predict what your changes will achieve and make it happen.

Code: [Select]
void Adafruit_MCP23017::pullUp(uint8_t p, uint8_t d) {
 uint8_t gppu;
 uint8_t gppuaddr;

 // only 16 bits!
 if (p > 15)
   return;

 if (p < 8)
   gppuaddr = MCP23017_GPPUA;
 else {
   gppuaddr = MCP23017_GPPUB;
   p -= 8;
 }


 // read the current pullup resistor set
 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
 wiresend(gppuaddr);
 Wire.endTransmission();
 
 Wire.requestFrom(MCP23017_ADDRESS | i2caddr, 1);
 gppu = wirerecv();

 // set the pin and direction
 if (d == HIGH) {
   gppu |= 1 << p;
 } else {
   gppu &= ~(1 << p);
 }

Quote
Does the MCP23017 have internal pull up resistors?
No.
Read this as to why you need them.
http://www.dsscircuits.com/articles/effects-of-varying-i2c-pull-up-resistors.html

[font=Verdana]NOTE: POR/RST
The Power-on Reset (POR) sets the registers to their
default values and initializes the device state machine.
RST=RESET
[/font]

==
the centipede library uses binary values and the adafruit library uses HEX
Quote
1.2
Power-on Reset (POR)
The on-chip POR circuit holds the device in reset until
VDD has reached a high enough voltage to deactivate
the POR circuit (i.e., release the device from reset).
The maximum VDD rise time is specified in Section 2.0
"Electrical Characteristics".
When the device exits the POR condition (releases
reset), device operating parameters (i.e., voltage,
temperature, serial bus frequency, etc.) must be met to
ensure proper operation.
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pitchoilcan

#66
May 20, 2012, 12:02 am Last Edit: May 20, 2012, 12:35 am by Pitchoilcan Reason: 1

[font=Verdana]Binary [/font][/b]
[font=Verdana]GPIOA[/font]
0000_0000 //
0000_0001 //C
0000_0010
0000_0011
0000_0100
0000_0101
0000_0110
0000_0111
0000_1000
0000_1001
0000_1010
0000_1011
0000_1100
0000_1101
0000_1110
0000_1111
[font=Verdana]GPIOB[/font]
0001_0000  //C#
0010_0000
0011_0000
0100_0000
0101_0000
0110_0000
0111_0000
1000_0000
1001_0000
1010_0000
1011_0000
1100_0000
1101_0000
1110_0000
1111_0000
1111_1111
[font=Verdana]HEX [/font][/b]
[font=Verdana]GPIOA[/font]
0x00
0x01
0x02
0x03
0x04
0x05
0x06
0x07
0x08
0x09
0x0A
0x0B
0x0C
0x0D
0x0E
0x0F
[font=Verdana]GPIOB[/font]
0x10
0x20
0x30
0x40
0x50
0x60
0x70
0x80
0x90
0xA0
0xB0
0xC0
0xD0
0xE0
0xF0
0xFF

http://wwweng.uwyo.edu/electrical/research/FroshECE/Microp/MicroprocessorsPORTHandout.pdf
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pitchoilcan

#67
May 20, 2012, 03:18 pm Last Edit: May 21, 2012, 02:47 am by Pitchoilcan Reason: 1
Quote
That's fine. But to use writeGPIOAB, you need to know how to set and clear individual bits in there.

Let's say your've got LEDs 1, 7, 9, and 14 lit up. Now, you want to also light up LED 12, but turn off LED 7. Do you know how to do that?

Quote
That's why I suggest you stick with digitalWrite.
The answer to the problem I posed then becomes simple:

Code: [Select]
mcp.digitalWrite(12, HIGH);
mcp.digitalWrite(7, LOW);

Quote
Let the MCP23017 library take care of all the arithmetic and maintain the current status of all the other LEDs.

http://forums.adafruit.com/viewtopic.php?f=25&t=28254&sid=23d2bfc1036b9e8c6b9e502b23145dd2&p=145851#p145851

============
pondering
void Adafruit_MCP23017::digitalWrite(uint8_t p, uint8_t d) {
 uint8_t gpio;
 uint8_t gpioaddr, olataddr;
OK so there is a function called digtalWrite in the library, how does it differ from WriteGPIOAB?
Is it that one write to the port and the other writes to the latches?
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pitchoilcan

#68
May 20, 2012, 10:24 pm Last Edit: May 21, 2012, 02:48 am by Pitchoilcan Reason: 1
Quote
by driverblock » Sun May 20, 2012 3:55 pm

writeGPIOAB writes all 16 port pins at once. digitalWrite writes to individual pins without changing the states of the other pins.
In this case, "latches" and "port pins" mean the same thing. When you write to a "pin", you're in fact setting a "latch".

http://forums.adafruit.com/viewtopic.php?f=25&t=28254#p145930
[font=Verdana]From my weekend's reading, I'm now pondering......[/font]

[font=Verdana](PCICR)[/font] Pin Change Interrupt Control Register, Pin Change Interrupt number[font=Verdana] (PCINT)[/font], Pin Change Interrupts, Pin Change Mask [font=Verdana](PCMSK)[/font], Pin Change Interrupt Register, [font=Verdana]pinMode and port-level interrupts[/font]. Consulting "[font=Verdana]Practical Arduino -The Book[/font]"
It might not be necessary to use/assign interrupts to my LED activity, my reading just led me down this path and it seems relevant to what I'm researching.  
TODO
weigh the PROs and CONs of change interrupts.  
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Grumpy_Mike

Quote
But to use writeGPIOAB, you need to know how to set and clear individual bits in there.

But you do, you use the OR operation to set bits and the AND operation to clear them.

Quote
(PCICR) Pin Change Interrupt Control Register

You are not using the chip to input data so there is no need to consider anything to do with the pin change registers.

Quote
and it seems relevant to what I'm researching.   

No it does not.

Quote
Does the MCP23017 have internal pull up resistors?.

You don't care, pull up resistors are only for inputs, you only want to light LEDs.




Pitchoilcan

#70
May 21, 2012, 01:37 am Last Edit: May 21, 2012, 03:25 pm by Pitchoilcan Reason: 1
Good to know. backing up one step......
Thanks mate!
Code: [Select]
void Adafruit_MCP23017::writeGPIOAB(uint16_t ba) {
 Wire.beginTransmission(MCP23017_ADDRESS | i2caddr);
 wiresend(MCP23017_GPIOA);
 wiresend(ba & 0xFF);
 wiresend(ba >> 8);
 Wire.endTransmission();

======
http://arduino.cc/en/Hacking/LibraryTutorial
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pitchoilcan

#71
May 21, 2012, 03:11 pm Last Edit: May 21, 2012, 04:54 pm by Pitchoilcan Reason: 1

Code: [Select]
Adafruit_MCP23017 mcp; // created an  object
so I need to add:
Code: [Select]
int pattern =0; //create an interger
and
Code: [Select]
mcp.writeGPIOAB(0, pattern); // write to port//pin
then  'if' statements:
Code: [Select]
if(PadNote[i] == 64) pattern |= 0x05; //condition
=============
working it out......
=============
Code: [Select]

if(PadNote[i] == 60) pattern |= 0x01;

              // the same goes for turning the LED off:-

if(PadNote[i] == 60) pattern &= ~0x01;


///////////
Quote
#include <Wire.h>
#include "Adafruit_MCP23017.h"

ledBits; // create  object

ledBits.initialize(); // set all registers to default

ledBits.portMode(0, 0b0000000000000000); // set all pins on chip 0 to output

/////////
//mcp.begin();      // set all registers to default
mcp.begin(0x05, 01010101); // set all registers to GPIOAB
//mcp.pinMode(0, OUTPUT);
mcp.pinMode(0, pattern); // set all pins on chip
Quote
On power up the device may be configured by sequentially writing to all of the registers


default
Quote
void setup() { 
  mcp.begin();      // use default address 0

  mcp.pinMode(0, OUTPUT);
}
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pitchoilcan

#72
May 21, 2012, 05:47 pm Last Edit: May 21, 2012, 07:02 pm by Pitchoilcan Reason: 1
http://forums.adafruit.com/viewtopic.php?f=25&t=28254&start=15#p145995
mcp.begin initializes the library with the address of the MCP23017 chip you want to talk to. It has nothing to do with gpioab.

The chip's address is determined by the wiring on the chip's pins 15, 16, and 17. The datasheet shows the locations of these pins:
http://www.adafruit.com/datasheets/mcp23017.pdf.
If they are all wired to ground, the chip's address is 0. If 15 is wired to Vcc while 16 and 17 are ground, then the chip's address is 1. So the three pins form a 3-bit binary number.

NOTE: Here, "pin" refers to the actual physical pins sticking out of the chip, not a software "pin" as used in the library.

ALSO NOTE: Every MCP23017 in your circuit MUST have a different address!

So, let's say your MCP23017 is wired for address 3. You would call
CODE: SELECT ALL
mcp.begin(3);


Okay, from now on, "pin" refers to the software pins as used by the library:
There is no library call to set the mode of all the pins all at once, so you have to do it one-at-a-time with calls to mcp.pinMode.

You've got 16 LEDs attached to your chip, right? So you want to set all 16 pins to OUTPUT. Do it with a loop:
CODE: SELECT ALL
for (int i=0; i < 16; i++) {
   mcp.pinMode(i,OUTPUT);
}


Now, you can start turning your LEDs on and off.

From your earlier post, I get the idea that you have some sort of array called PadNote, and you want to map a PadNote value of 60 to LED 0, 61 to LED 1, 62 to LED 2, etc. Right? If so, then you can simply do something like this, instead of a big bunch of if statements:
CODE: SELECT ALL
if ((PadNote >= 60) && (PadNote <= 75)) {
   mcp.digitalWrite(PadNote-60, HIGH);
}


Now, if you absolutely INSIST on using writeGPIOAB instead of digitalWrite, then you would have to do something like this instead:
CODE: SELECT ALL
if ((PadNote >= 60) && (PadNote <= 75)) {
  pattern |= (1 << ((PadNote-60);
  mcp.writeGPIOAB(pattern);
}


Turn the LEDs off this way:

CODE: SELECT ALL
if ((PadNote >= 60) && (PadNote <= 75)) {
   mcp.digitalWrite(PadNote-60, LOW);
}


- OR -

CODE: SELECT ALL
if ((PadNote >= 60) && (PadNote <= 75)) {
  pattern &= ~(1 << ((PadNote-60);
  mcp.writeGPIOAB(pattern);
}

//
Quote
I was told "only a moron would use 4051 multiplexers to drive leds" right here in this, my beloved forum and yet I see entire sections in "Practical Arduino -The book" and other sources dedicated to that subject.  Pardon me for being so verbose, caveat: beginners take everything literal.

Thanks much for all of your assistance.
TTYL
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pitchoilcan

#73
May 22, 2012, 02:57 am Last Edit: May 22, 2012, 04:21 pm by Pitchoilcan Reason: 1
:smiley-eek-blue:
Basic ada-TEST (successful)
Code: [Select]
#include <Wire.h>
#include "Adafruit_MCP23017.h"

// Basic output for all pins MCP23017 I/O expander
// public domain!

// Connect pin #12 of the expander to Analog 5 (i2c clock)
// Connect pin #13 of the expander to Analog 4 (i2c data)
// Connect pins #15, 16 and 17 of the expander to ground (address selection)
// Connect pin #9 of the expander to 5V (power)
// Connect pin #10 of the expander to ground (common ground)

// All outputs are connected to LEDs through a reistor to ground

Adafruit_MCP23017 mcp;
 
void setup() {  
 mcp.begin();      // use default address 0
 // make all pins outputs
 for(int i=0; i<16; i++){
 mcp.pinMode(i, OUTPUT);
 }
}

// blink each output in turn

void loop() {
for(int i=0; i<16; i++){  
 mcp.digitalWrite(i, HIGH);
 delay(100);
 mcp.digitalWrite(i, LOW);
 delay(100);
 }
}
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Pitchoilcan

#74
May 22, 2012, 03:55 am Last Edit: May 22, 2012, 03:19 pm by Pitchoilcan Reason: 1
no luck. Exactly why the vanilla or unmodified code no longer works is secondary to me at this point. I'm still focused on the mcp23017 and LEDs for the moment.
================================
http://twit.tv/floss61
Think different
Think UbuntuStudio
============================

Go Up