Show Posts
Pages: [1] 2 3 ... 24
1  Forum 2005-2010 (read only) / Troubleshooting / Re: Can Arduino "speak" to an Xbee without a shield? on: March 10, 2009, 11:29:07 am
you should be able to integrate the xbee without a shield no problems. You just got to be careful that you are powering the xbee with 3.3V How are you hooking up the xbee to the arduino?
2  Forum 2005-2010 (read only) / Syntax & Programs / Re: Arduino Clock: Setting Time on: April 07, 2009, 11:31:39 am
Is you arduino going to always be connected to the computer? Or are you just using the computer to program the Arduino, and then unplugging the Arduino and leaving it running as a stand alone, through a wallwart or battery?

If you are going to leave it connected to the computer, this is fairly easy. Your computer can do the counting and when the alarm is hit it can send a message over serial to the arduino, the arduino can then parse this message and set the LED accordingly.

If you are going to be unpluggin the arduino it gets a little complicated. I would use an external timing IC and battery back it up. I would use one that has some sort of memory like the DS1307
3  Forum 2005-2010 (read only) / Syntax & Programs / Re: Edit: First (Simple) Library Not Working on: April 07, 2009, 12:28:32 pm
Haha no worries!

I was just working on making modifications to the RotaryEncoder library yesterday and ran into a few frustrating issues similar to yours.
4  Forum 2005-2010 (read only) / Syntax & Programs / Re: Edit: First (Simple) Library Not Working on: April 07, 2009, 12:10:25 pm
try

Sts testSts;

instead of

Sts testSts();

5  Forum 2005-2010 (read only) / Syntax & Programs / Re: Edit: First (Simple) Library Not Working on: April 07, 2009, 11:58:33 am
Don't you have to construct an object?

Does this work:
Code:
#include <Sts.h>

Sts testSts();
void setup(){
}

void loop() {
 for(int i=0; i<26; i++) {
   testSts.displayCap(i);
   delay(500);
 }
}
6  Forum 2005-2010 (read only) / Syntax & Programs / Re: Any syntax in arduino like on: February 06, 2009, 10:55:15 am
never worked with actionscript or flash before but from my understanding setInterval performs a certain action after a set amount of time right?

so if I went:
 
Code:
setInterval( getX(), 1000 );
it would call getX() every 1000 milliseconds right?

this would be the Arduino equivalent:
Code:
void getX(){
//whatever you want the function to do
}
then inside your setup:
Code:
intervaltime=1000;
currenttime=millis();
and in your main loop:
Code:
if(millis()>=currenttime+intervaltime)
{
  getX();
  currenttime=millis();
}
NOTE: this is assuming your loop completes multiple times in a second. This will not work if you want to set an interval at a time smaller than which it takes the program to loop through once. If thats the case you would be looking at interrupts.
7  Forum 2005-2010 (read only) / Syntax & Programs / Re: Help with counting on: January 29, 2009, 09:46:14 am
K i don't really get what is going on with your code, but here is some code to count the number of times a button is pressed:

Code:
int inPin = 7;         // the number of the input pin
int reading;           // the current reading from the input pin
int previous = LOW;    // the previous reading from the input pin
int count=0; //number of times button was pressed

// the follow variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long time = 0;         // the last time the output pin was toggled
long debounce = 200;   // the debounce time, increase if the output flickers

void setup()
{
  pinMode(inPin, INPUT);
}

void loop()
{
  reading = digitalRead(inPin);

  // if we just pressed the button (i.e. the input went from LOW to HIGH),
  // and we've waited long enough since the last press to ignore any noise...  
  if (reading == HIGH && previous == LOW && millis() - time > debounce) {
    //increment count
    count++;

    // ... and remember when the last button press was
    time = millis();    
  }
  previous = reading;

  if (count==20)
  {
    //whatever you want to do over here
    count=0; //reset count
  }

}



I just modified the debounce code in the learning section of the main site
8  Forum 2005-2010 (read only) / Interfacing / Re: LCD help..... on: January 23, 2009, 02:36:34 pm
The readme file on the website tells all.

I copied it here:
Code:
This is a C++ library for Arduino for controlling an HD74800-compatible LCD in 4-bit mode.
Tested on Arduino 0010

Installation
--------------------------------------------------------------------------------

To install this library, just place this entire folder as a subfolder in your
Arduino/lib/targets/libraries folder.

When installed, this library should look like:

arduino-0010/hardware/libraries/LCD4Bit_mod              (this library's folder)
arduino-0010/hardware/libraries/LCD4Bit_mod/LCD4Bit_mod.cpp  (the library implementation file)
arduino-0010/hardware/libraries/LCD4Bit_mod/LCD4Bit_mod.h    (the library description file)
arduino-0010/hardware/libraries/LCD4Bit_mod/keywords.txt (the syntax coloring file)
arduino-0010/hardware/libraries/LCD4Bit_mod/examples     (the examples in the "open" menu)
arduino-0010/hardware/libraries/LCD4Bit_mod/readme.txt   (this file)

Building
--------------------------------------------------------------------------------

After this library is installed, you just have to start the Arduino application.
You may see a few warning messages as it's built.

To use this library in a sketch, go to the Sketch | Import Library menu and
select LCD4Bit_mod.  This will add a corresponding line to the top of your sketch:
#include <LCD4Bit_mod.h>

To stop using this library, delete that line from your sketch.

Geeky information:
After a successful build of this library, a new file named "LCD4Bit_mod.o" will appear
in "Arduino/lib/targets/libraries/LCD4Bit". This file is the built/compiled library
code.

If you choose to modify the code for this library (i.e. "LCD4Bit_mod.cpp" or "LCD4Bit_mod.h"),
then you must first 'unbuild' this library by deleting the "LCD4Bit_mod.o" file. The
new "LCD4Bit_mod.o" with your code will appear after the next press of "verify"

There are example on the site too:
http://www.ekitszone.com/index.php?main_page=product_info&cPath=1&products_id=2&zenid=5edebb78bc0b0782789ffadb46aec31b
9  Forum 2005-2010 (read only) / Interfacing / Re: I need to amplify a mv signal into the Arduino on: February 04, 2009, 11:28:57 am
Yup, I was just looking at the op amp I regulary use (cause its free!) and it wouldn't work very well for you. If you are interested its the MCP6001 from Microchip. It costs approx 25 cents. The max input offset voltage is 4.5 mV which could cause you some problems (Its half your swing!).

If you do go this path (cause its much cheaper), you are probably going to have to use some sort of trimming resistor going into the input pins. Maybe a pot in conjunction with your normal gain resistor.

If money isn't an issue go with jluciani's op amp. It should work perfectly for you without any issues. Plus my solution isn't sustainable as each opamp will have a different offset voltage. Therefore if you are building multiple copies of your design, you'll have a lot of debugging to do.
10  Forum 2005-2010 (read only) / Interfacing / Re: I need to amplify a mv signal into the Arduino on: February 03, 2009, 06:20:35 pm
might need to cascade multiple op amps for a gain of 500. The cheap op amps I worked with stopped being 'ideal' around a gain of 100
11  Forum 2005-2010 (read only) / Interfacing / Re: Fade LED in and out once through Processing on: January 23, 2009, 02:28:47 pm
hmm... try making val an int instead of byte and declare it outside the loop. Also use Serial.print and check whats getting printed on the arduino's serial checker.

also maybe use a Serial.flush before the read

modified code:

[code]

//outside loop
int val;

//inside loop
val=-1;
while(val==-1)
{
  Serial.flush();
  val=Serial.read();
  //Serial.println(val); //use this to debug
}

12  Forum 2005-2010 (read only) / Interfacing / Re: Fade LED in and out once through Processing on: January 23, 2009, 01:06:16 pm
your problem lies here:

Code:
if (Serial.available())
   // read the most recent byte (which will be from 0 to 255)
   val = Serial.read();

you will always skip this statement and keep looping. You need to stop your code over here till yousend it another command over serial.

change it to something like :

Code:
val=-1;
while(val==-1)
  val=Serial.read();

I'm pretty sure this will work. Haven't had time to test though.

Serial.read() recieves a -1 if no serial commands were sent. The while loop will keep looping till you send it a serial command.
13  Forum 2005-2010 (read only) / Development / Re: TWIPROM - I2C Library for 24LC256 on: February 10, 2009, 03:36:45 pm
hmm.. this is interesting. On one project I am working on, I am running out of flash space and was thinking about interfacing with an external eeprom. I don't really understand what the advantage of changing the address is. I thought the address only matters when trying to communicate to multiple devices on the same bus, so the bus knows which device you are trying to communicate with.

Does changing the address on the EEPROM give you access to more memory? Also does this mean, if I use this method, I won't be able to access any more devices on the I2C bus?
14  Forum 2005-2010 (read only) / Development / Re: Buttons (one-shot & hold library) on: January 29, 2009, 12:25:18 pm
hmm.. i like this! saves me from writing cluttered debounce code. I like the pull-up resistor feature.

hopefully will get time to implement this sometime this weekend, will tell you how it goes
15  Forum 2005-2010 (read only) / Troubleshooting / Re: Connecting LilyPad Arduino to LilyPad Xbee on: March 10, 2009, 10:23:03 am
did you program the xbee's correctly?
did you program the arduino correctly?

could we see the arduino code, and the xbee configuration?
Pages: [1] 2 3 ... 24