Loading...
  Show Posts
Pages: 1 [2] 3 4
16  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...
17  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);
  }
}

18  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.
19  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
20  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.
21  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.
22  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
23  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:
24  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.
25  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.

26  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...
27  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).
28  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.
29  Development / Suggestions for the Arduino Project / More Arduino 1.0 issues on: November 20, 2011, 03:41:51 am
I'm now trying to port the gaikl ArduinoEthernet libraries to 1.0 RC 2.

I'm using Pauls tip:

#if ARDUINO >= 100
  #include "Arduino.h"
#else
   #include "WProgram.h"
#endif

But I still get a lot of errors. It seems to be they changed more than just renaming WProgram.h to Arduino.h and "Renamed Ethernet Client, Server, and UDP classes to EthernetClient, EthernetServer, and EthernetUDP."

Any leads on this?!

I changed:
   #include "wiring.h"
to

#if ARDUINO >= 100
  #include "Arduino.h"
#else
   #include "wiring.h"
#endif

as discussed here:
http://code.google.com/p/arduino/issues/detail?id=682

But other header files like
#include <string.h>
#include <stdlib.h>
#include <inttypes.h>

seem to be redundant now so I also made those conditional.

E.g. Paul can you elaborate on that?! I can't find the reason for these errors other than that Arduino.h is redeclaring stuff that is already declared using the mentioned header files.

Most of the time errors are of this form:

In file included from /Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Arduino.h:191,
                 from /Applications/Arduino.app/Contents/Resources/Java/libraries/EthernetBonjour/EthernetBonjour.cpp:29:
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:116: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, const char*)' conflicts with
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:115: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const String&)' here
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:117: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, char)' conflicts with
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:116: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const char*)' here
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:118: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, unsigned char)' conflicts with
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:117: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, char)' here
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:119: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, int)' conflicts with
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:118: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, unsigned char)' here
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:120: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, unsigned int)' conflicts with
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:119: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, int)' here
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:121: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, long int)' conflicts with
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:120: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, unsigned int)' here
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:122: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, long unsigned int)' conflicts with
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/WString.h:121: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, long int)' here
In file included from /Applications/Arduino.app/Contents/Resources/Java/libraries/EthernetBonjour/EthernetBonjour.cpp:29:
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Arduino.h:195: error: declaration of C function 'uint16_t makeWord(byte, byte)' conflicts with
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Arduino.h:194: error: previous declaration 'uint16_t makeWord(uint16_t)' here
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Arduino.h:205: error: declaration of C function 'long int random(long int)' conflicts with
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/include/stdlib.h:504: error: previous declaration 'long int random()' here
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Arduino.h:206: error: declaration of C function 'long int random(long int, long int)' conflicts with
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Arduino.h:205: error: previous declaration 'long int random(long int)' here

30  Development / Suggestions for the Arduino Project / Arduino Pro Mini + 1.0 RC2 + RF24 on: November 14, 2011, 03:24:42 pm
For my students I'm testing RF24 with Arduino 1.0 RC 2

I am getting strange errors:
SPI/SPI.h

Arduino.h: No such file or directory

Arduino.h is there in hardware/arduino/cores/arduino (inside Arduino app on my Mac).
So any idea on how this issue is happening and so how to solve it?! (Except by putting the Arduino.h file and all other dependent files in libraries...)
it just doesn't seem to be able to find the core files.
Pages: 1 [2] 3 4