Show Posts
Pages: 1 2 [3] 4 5
31  Using Arduino / LEDs and Multiplexing / Re: Charlieplexing issue on: May 14, 2012, 12:27:27 am
Code:
  pinMode(ledpinA, OUTPUT);
  digitalWrite(ledpinA, HIGH);
  pinMode(ledpinB, INPUT);
  digitalWrite(ledpinB, LOW);
  pinMode(ledpinC, OUTPUT);
  digitalWrite(ledpinC, LOW); 
  pinMode(ledpinD, INPUT);
  digitalWrite(ledpinD, LOW);


That didn't do the trick unfortunately. Even not with pull down resistors (I understand why my first option didn't work since of course it drew the B and D high instead of low).

I could use an XOR port but that makes the circuit more complicated of course...
32  Using Arduino / LEDs and Multiplexing / Charlieplexing issue on: May 13, 2012, 04:22:46 pm
I am trying to control two traffic lights using 4 pins and charlieplexing...

All modes work save both red (and that should be the initial state so...
It gives me two lights with both red and green on.



Code:

|----->4---------+
|                    |
|-<5-+-<2-+-<1-+
|      |     |     |
|->6-|->3-|     |
|      |     |     |
A     B      C    D

Note: > and < are LED's
+ is just a node
A, B, C and D are digital pins on an Arduino 2009



1 and 4 are green
2 and 5 are yellow
3 and 6 are red

I use this code:
Code:
pinMode(ledpinA, OUTPUT);
  digitalWrite(ledpinA, HIGH);
  pinMode(ledpinB, INPUT);
  digitalWrite(ledpinB, HIGH);
  pinMode(ledpinC, OUTPUT);
  digitalWrite(ledpinC, LOW);  
  pinMode(ledpinD, INPUT);
  digitalWrite(ledpinD, HIGH);

A should be +, B input with pull-up activated, C - and D also input with pull-up
That way only red should be activated since D is not giving any output, but it is :s

Any help appreciated.

Below the circuit in Fritzing:



Left signal is straight, right in an L-shape (just the circuit design of course, not the real light...)
33  Using Arduino / LEDs and Multiplexing / Re: MCP2300x behaviour on: April 27, 2012, 03:40:27 am
Well, that explains a lot smiley-wink

Thanks!!! So now I just need to rewire the signals...
34  Using Arduino / LEDs and Multiplexing / MCP2300x behaviour on: April 27, 2012, 02:11:11 am
I have a MCP23009 IC that I want to use as out put. So far so good, I used it once before as input and the ..17 as output, but...

I get a strange result. The LEDs will blink, but only if I connect them anode/plus to the V+ and cathode/minus to the mcp pin

This is the source:

Code:

#include <Wire.h>
#include "MCP23009.h"

// Basic toggle test for i/o expansion. flips pin #0 of a MCP23009 i2c
// pin expander up and down. Public domain

// Connect pin #1 of the expander to Analog 5 (i2c clock)
// Connect pin #2 of the expander to Analog 4 (i2c data)
// Connect pins #3, 4 and 5 of the expander to ground (address selection)
// Connect pin #6 and 18 of the expander to 5V (power and reset disable)
// Connect pin #9 of the expander to ground (common ground)

// Output #0 is on pin 10 so connect an LED or whatever from that to ground

// Note, based on MCP23009, but I modified it a bit
// (lib was originally made for mcp23008
// that code checks for addresses < 7 and my mcp has the address pin connected to 5V (and so has address 0x27)

MCP23009 mcp;

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

  for (int i=0; i< 8; i++)
    mcp.pinMode(i, OUTPUT);
}

// werkt wel, maar soms omgekeerd (dus de OUTPUT als GND?!)

// flip the pin #0 up and down

void loop() {

  for (int i=0; i< 8; i++) {
    //mcp.pinMode(i, OUTPUT);
    delay(1000);
    mcp.digitalWrite(i, HIGH);

    delay(1000);

    mcp.digitalWrite(i, LOW);
  }
}

35  Topics / Home Automation and Networked Objects / Re: Operate from Blackberry/Android/Iphone-Ipad/Nokia/PC/Mac across the Globe W/O PC on: April 05, 2012, 02:17:38 am
Nice idea (b.t.w. using bonjour it will work even better)...

I actually don't see the source but I might be confused.
36  Using Arduino / Microcontrollers / Re: Arduino Tiny on: March 12, 2012, 02:58:40 pm
@Coding Badly:

Almost:
A with one servo works (B no servo)
B with one servo works (A no servo)

Problems when:
1 connecting two servos to either A or B
2 connecting servos to A and B
37  Using Arduino / Microcontrollers / Re: Arduino Tiny on: March 11, 2012, 03:17:27 pm
I'm using the arduino tiny software (http://code.google.com/p/arduino-tiny/) to try and control two servos with an ATtiny84. I have quite some timing problems as it seems to be. When I connect one servo to pin PA6 and use this software:

Code:
// Based on Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
// Changed by Johan

#include <Servo.h>
 
Servo myservo;  // create servo object to control a servo
                // a maximum of eight servo objects can be created
 
int pos = 0;    // variable to store the servo position
int posMin = 17;
int posMax = 65;
 
void setup()
{
  myservo.attach(4);  // attaches the servo on pin 4 to the servo object
}
 
 
void loop()
{
  for(pos = posMin; pos < posMax; pos += 1)  // goes from posMin degrees to posMax degrees
  {                                  // in steps of 1 degree
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  delay(3000);
  for(pos = posMax; pos>=posMin; pos-=1)     // goes from posMax degrees to posMin degrees
  {                               
    myservo.write(pos);              // tell servo to go to position in variable 'pos'
    delay(15);                       // waits 15ms for the servo to reach the position
  }
    delay(3000);
}

This works well...

However, I need to control two servos. Their position should be the same so I tried to connect them to one output. This makes the servos to jiggle with no avail. I also can't seem to get the servos work on another port.
I have tried using internal clock at 8Mhz and 16Mhz with an external resonator. Also capacitors.

Any ideas?!

Update:

Code:
// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.


#include <Servo.h>
 
Servo myservo1;  // create servo object to control a servo
Servo myservo2;  // create servo object to control a servo
                // a maximum of eight servo objects can be created
 
int pos = 0;    // variable to store the servo position
int posMin = 17;
int posMax = 65;
 
void setup()
{
  myservo1.attach(4);  // attaches the servo on pin 9 to the servo object
  myservo2.attach(5);  // attaches the servo on pin 9 to the servo object
}
 
 
void loop()
{
  for(pos = posMin; pos < posMax; pos += 1)  // goes from 0 degrees to 180 degrees
  {             // in steps of 1 degree
    myservo1.write(pos);
    delay(7);
    myservo2.write(pos);              // tell servo to go to position in variable 'pos'
    delay(7);                       // waits 15ms for the servo to reach the position
  }
  delay(3000);
  for(pos = posMax; pos>=posMin; pos-=1)     // goes from 180 degrees to 0 degrees
  {                     
    myservo1.write(pos);
    delay(7);
    myservo2.write(pos);              // tell servo to go to position in variable 'pos'
    delay(7);                      // waits 15ms for the servo to reach the position
  }
    delay(3000);
}

this also works when connecting one servo to 4 or 5 but not when I connect two servos to either port.
38  Community / Products and Services / Re: Olimex Duinomite - anyone experience? on: January 18, 2012, 01:57:10 am
Well, for just 30€ (plus 10€ for the case) they are very cheap aren't they!
I guess it is a nice one.
39  Community / Products and Services / Re: Should I wait for Due? on: January 18, 2012, 01:53:50 am
Uhm, I guess even if the Due would be available it would be wise to start with the UNO. The Due is much more complex. It is an embedded system, so I don't think you will run into problems. If you want to do video processing it is better to wait for the Due smiley
40  Using Arduino / LEDs and Multiplexing / Re: Any experience with mcp23009 on: January 04, 2012, 05:24:45 pm
Thanks Mike,

I still have problems getting it up and running. At this moment I connect address to ground or 5V (with a jumper). I don't use the 4k7 (yet) since I have no other i2c devices connected and a short cable. Do I need to connect the RST (inverted) to 5V?!

Update:
I did that and now it works smiley

Based on ladyada MCP23008 lib and example.
Code:
#include <Wire.h>
#include "MCP23008.h"

// J.A. Korten - 4-1-2012
// Based on: MCP23008 button example from Ladyada.com
// Intelligent LEGO train station bench.

// Basic toggle test for i/o expansion. flips pin #0 of a MCP23008 i2c
// pin expander up and down. Public domain

// Connect pin #1 of the expander to Analog 5 (i2c clock)
// Connect pin #2 of the expander to Analog 4 (i2c data)
// Connect pins #3, 4 and 5 of the expander to ground (address selection)
// Connect pin #6 and 18 of the expander to 5V (power and reset disable)
// Connect pin #9 of the expander to ground (common ground)

// Output #0 is on pin 10 so connect an LED or whatever from that to ground

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

  mcp.pinMode(0, OUTPUT);
}


// flip the pin #0 up and down

void loop() {
  delay(100);

  mcp.digitalWrite(0, HIGH);

  delay(100);

  mcp.digitalWrite(0, LOW);
}

Result:
41  Using Arduino / LEDs and Multiplexing / Re: Any experience with mcp23009 on: January 03, 2012, 11:03:46 am


I hope this will work. According to the mcp23009 datasheet, one selects the address by connecting the selection pin to a certain voltage between in our case 0 and 5V.
42  Using Arduino / LEDs and Multiplexing / Any experience with mcp23009 on: January 03, 2012, 06:23:26 am
I'm trying to control extra pins with a mcp23009 but... there is not a lot of good documentation (at least I can't find it). I have mcp23008 and pcf8574 experience, but I thought this one would be a need challenge for a chance.

43  Development / Suggestions for the Arduino Project / Re: More Arduino 1.0 issues on: November 20, 2011, 04:27:26 am
I solved the compile errors for EthernetBonjour.cpp by placing #include "Arduino.h" below the other includes:


//  Copyright (C) 2010 Georg Kaindl
//  http://gkaindl.com
//
//  This file is part of Arduino EthernetBonjour.
//
//  EthernetBonjour is free software: you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public License
//  as published by the Free Software Foundation, either version 3 of
//  the License, or (at your option) any later version.
//
//  EthernetBonjour is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with EthernetBonjour. If not, see
//  <http://www.gnu.org/licenses/>.
//

#define  HAS_SERVICE_REGISTRATION      1  // disabling saves about 1.25 kilobytes
#define  HAS_NAME_BROWSING             1  // disable together with above, additionally saves about 4.3 kilobytes

#include <string.h>
#include <stdlib.h>

extern "C" {
   #include <utility/EthernetUtil.h>
}

#include <utility/EthernetCompat.h>
#include "EthernetBonjour.h"
#include "Arduino.h"

// then the rest of the 'old' code...
44  Development / Suggestions for the Arduino Project / Re: More Arduino 1.0 issues on: November 20, 2011, 04:19:36 am
Ha that makes sense!!! I will remember that.

But... I mainly used in (now only use it) in Libraries, so that is not the problem I think (although it was very useful to remember this).
45  Development / Suggestions for the Arduino Project / Re: More Arduino 1.0 issues on: November 20, 2011, 04:05:31 am
Ooh really, but why then are people like Paul Stoffregen advising me to do it like that?!

http://arduino.cc/forum/index.php/topic,78985.0.html

That actually works.

And a lot of other excellent working libraries use the same construction. So either I don't get you or something else!?!

B.t.w. I removed the conditional stuff to no avail, same errors.
Pages: 1 2 [3] 4 5