Show Posts
Pages: 1 [2]
16  Forum 2005-2010 (read only) / Troubleshooting / Re: only pin 13 Works on: December 27, 2010, 08:20:23 pm
When I first started, I didn't, just followed Lady Ada's documentation.  But yes, that is the next step if you're brand new smiley  

http://www.ladyada.net/learn/arduino/lesson1.html

I use proper resistors on my stuff, but if you're just starting, it isn't necessarily needed for a proof that something works.  I guess I didn't think to argue with her.  And when I tried it (I held my breath) it did work.
17  Forum 2005-2010 (read only) / Troubleshooting / Re: only pin 13 Works on: December 27, 2010, 08:07:11 pm
Code:
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
 */

void setup() {                
  // initialize the digital pin as an output.
  pinMode(12, OUTPUT);    
}

void loop() {
  digitalWrite(12, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(12, LOW);    // set the LED off
  delay(1000);              // wait for a second
}

That should work...if it isn't, there is something else going on that may be above my pay grade smiley-razz  

As it was pointed out, you should use a proper resistor (do a quick google search for a LED resistor calculator).  Pin -> Resistor -> Anode (long pin) -> Cathode (short pin) in GND.
18  Forum 2005-2010 (read only) / Troubleshooting / Re: only pin 13 Works on: December 27, 2010, 08:02:55 pm
Post your code in code tags (it is the # sign on the message dialog).  That'll help to see what is going on.

Early thoughts though, are you setting your pins to be outputs?
19  Forum 2005-2010 (read only) / Interfacing / Re: Running LCD display and tlc5940 simultaneously on: January 18, 2011, 04:01:05 am
Has anyone had any more experience with this in the past year?  I'm having the exact same problem.
20  Forum 2005-2010 (read only) / Interfacing / Re: Problems with MCP23017 - 16 bit Port Expander on: December 28, 2010, 01:20:38 pm
Mace, I love you man.  I've been up and down that darn datasheet so many times, but I must have just completely missed that part.  It seems to work just fine with it being tied to the 5V rail without a resistorEDIT: Put a 1K resistor from /RESET to Vdd just incase.  What kind of resistor are you using?  

Also, the project I'm working on needs to utilize pretty much the full function of the chip.  I'd be happy to share my interrupt code with you for your centipede shield. (It will be interrupting on change from receiving input (high/low) from a 38 kHz IR receiver, the new 3 pin through hole one from sparkfun to be exact).

Anyways, thanks again, I have a lot of work to do today!

-Tweed
21  Forum 2005-2010 (read only) / Interfacing / Re: Problems with MCP23017 - 16 bit Port Expander on: December 27, 2010, 09:09:01 pm
Here's a picture of my setup.  The yellow wire I just recently put there to reset it if need be.

http://imgur.com/x26xH.jpg

-Tweed
22  Forum 2005-2010 (read only) / Interfacing / Problems with MCP23017 - Solved on: December 27, 2010, 08:16:19 pm
Never really post on this forum for help, try to figure things out myself, posted this in the wrong forum to begin with.  Here's the original post:

I've tried all sorts of things to get this to work.  The most stable seems to be a 9V battery hooked into the Arduino as the power source, but it can stop working.  Powered via USB it always seems to just randomly stop working quickly.

My code is simply a sketch to get an LED blinking (sets high all the GPIOA bits followed by delay and setting them low, etc).
Code:
/* Wiring

MCP23017 Pins
Pin 9  = Vdd  = 5V
Pin 10 = Vss  = Gnd

Pin 12 = SCL  = Arduino A5 (4.7K resistor to 5V)
Pin 13 = SDA  = Arduino A4 (4.7K resistor to 5V)

Pin 15 = A0   = Gnd
Pin 16 = A1   = Gnd
Pin 17 = A2   = Gnd

Pin 21 = GPA0 = Resistor -> LED -> Gnd

*/

//using raw addresses and hex values to ensure there are no other problems

#include "Wire.h"

void setup(){
  
  //Send initial configuration to MCP23017
  Wire.begin();
  
  Wire.beginTransmission(0x20); //opcode/address of chip
  Wire.send(0x12); //iocon
  Wire.send(0x20); //disable sequential addresses
  Wire.endTransmission();

  Wire.beginTransmission(0x20);
  Wire.send(0x00); //iodira
  Wire.send(0x00); //all 0's, all outputs
  Wire.send(0x00);
  Wire.endTransmission();

}

void turnOnLED()
{

  Wire.beginTransmission(0x20);
  Wire.send(0x12); // gpioa
  Wire.send(0xff);  // all high
  Wire.send(0xff);
  Wire.endTransmission();
  
}

void turnOffLED()
{

  Wire.beginTransmission(0x20);
  Wire.send(0x12); // gpioa
  Wire.send(0x00); // all low
  Wire.send(0x00);
  Wire.endTransmission();
  
}

void loop(){

  turnOnLED();
  digitalWrite(13, HIGH);
  delay(100);
  turnOffLED();
  digitalWrite(13, LOW);
  delay(100);
  
}

There are 4.7k pull ups on the SDA and SCL lines.  I guess my question is, why wouldn't this loop forever, why would it just stop for no reason.

Any help would be great!

EDIT: From what I'm reading there may be a problem with the wire library not dealing with ACK bits.  Is there any work around for this?

Also, the chip is very touchy, if it stops responding, I have to manually reset it using the RESET pin, it works fine again after that...for awhile.  The centipede library has the same problem as well with my setup.

SOLVED:  Thanks to macegr, the /RESET pin was just flapping around in the wind and needs to be tied into the Vdd.  Here is how I have it wired now: http://imgur.com/b3nFf.jpg (EDIT: put a 1K resistor in place of the yellow wire).

-Tweed
23  Forum 2005-2010 (read only) / Bar Sport / Re: Left my phone wall charger at my friends house... on: December 30, 2010, 01:45:01 am
Ya, I don't really want to know either, LOL.  I like your uncertainty reference lefty.
24  Forum 2005-2010 (read only) / Bar Sport / Re: Left my phone wall charger at my friends house... on: December 30, 2010, 01:20:48 am
I have a degree in chemistry.  I'm never going to be happy unless I have a few instruments that I can use to recreate lab conditions.  A variable power supply is a must! smiley-razz  

BTW, the one I got is a "cheap" ~$40 one off ebay.  But it works beautifully and having that for random needs is invaluable.

-Tweed
25  Forum 2005-2010 (read only) / Bar Sport / Left my phone wall charger at my friends house... on: December 29, 2010, 10:52:09 pm
No problem!  Set my power supply to 12V and hook it up to my car charger. smiley  Does anyone else use their power supply for anything like that?

-Tweed
Pages: 1 [2]