Show Posts
Pages: 1 [2]
16  Using Arduino / Networking, Protocols, and Devices / Re: Sudden unreliability with my network-enabled Arduino project on: August 27, 2012, 10:44:34 am
One thing that nobody else has suggested--is it possible that the orientation of the circuitry is affecting the connections? I notice that the board is upside-down on your ceiling, but I presume that when you take it down to test it, you're putting it right-side up on your workbench. Perhaps a connection is coming loose when it's upside-down but falls back into place when it's rightside-up?
17  Using Arduino / Programming Questions / Re: Reliability? Error handling? Soft reset? on: August 26, 2012, 03:53:25 pm
I've used the AVR watchdog with no problems whatsoever. It's a good idea if a program lock-up could cause some sort of problem (in my case, disabling my security system). I've never had any problems with Serial.print(), but if it uses Strings (idk if it does) that could cause some problems, as Strings may leak memory. It's generally a good idea to use char arrays instead. I've had my Arduino running all night with no problems, but it might have reset itself via watchdog when I was asleep at the other end of the house.
18  Using Arduino / Sensors / Re: Too many if statements?? Please help on: August 26, 2012, 01:22:39 pm
Have you tried taking out as much code as possible to make the problem still happen? For example, what happens if you replace the playfile() code with a single Serial.print statement? If the problem still exists, take some code out from somewhere else... this way, you have a lot less code, but you still have the problem which is then easier to track down (you just removed half the haystack).
19  Development / Other Software Development / Re: New Library for BiColor LEDs on: August 26, 2012, 01:10:11 pm
Quote
To turn the LED red, pin1 is set HIGH and pin2 is set low, so the power goes one way. To turn it green, the polarity of the two pins is swapped, so the power goes the other way. Yellow is produced by rapidly switching between red and green, producing AC
You are not producing AC. AC is alternating current, where the voltage changes from positive to negative 50 or 60 times per second. All you are doing is switching which way the current, at +5V, is flowing.
I refer you to Merriam-Webster's definition of Alternating Current: http://www.merriam-webster.com/dictionary/alternating+current.
Quote
an electric current that reverses its direction at regularly recurring intervals
  • An electric current: This is electricity we're working with, even at 5V.
  • that reverses its direction: in other words, which way the current is flowing
  • at regularly recurring intervals: If you call drive() at regularly recurring intervals (which you should, to make the yellow look right), then the current reverses at regularly recurring intervals.

If there's any part of this you don't understand, have a look at my explanation above, or hook the output of my library up to an oscilloscope and see for yourself.
20  Development / Other Software Development / Re: New Library for BiColor LEDs on: August 24, 2012, 11:22:36 pm
I just released version 1.1 of this library. The new version adds support for alternating between two colours. You can download it from the playground page.
21  Using Arduino / Programming Questions / Re: Arduino - Control Browser Location on: August 01, 2012, 04:08:21 pm
What if, rather than sending a webpage, you used a telnet connection? Every time the Arduino sees an RFID tag, it sends the ID of the tag over the telnet connection. If you really want a webpage, you could code something similar to http://wolfgang.site40.net/telnet/ (my website), which uses a Java applet to establish a connection to the telnet server. If you want, you could probably even code up a custom applet that only displays the last line sent.
22  Using Arduino / Programming Questions / Re: POST HTTP with AT Commands on: August 01, 2012, 03:34:30 pm
Based on a quick reading of the datasheet, I don't think the SIM900 supports HTTP. You'll have to establish a TCP connection and then manually negotiate the HTTP.
23  Development / Other Software Development / Re: EEPROMex library - An extension of the standard Arduino EEPROM library on: August 01, 2012, 01:21:28 pm
if this tests out, it would be  a great improvement / addition to the standard lib.
I agree. I was fiddling with the builtin EEPROM library, making a way to store events and timestamps, and ran into the problem that timestamps wouldn't store into 1 byte. I eventually wound up packing them in a really odd way with a 12.3 second resolution or some such so I could fit them in 2 bytes--as I recall, the first byte was the week and the second byte was split into the day & time in some strange way. It didn't really work too well. A library like this would have been really helpful.
24  Development / Other Software Development / Re: New Library for BiColor LEDs on: August 01, 2012, 12:28:06 pm
Quote
by passing AC current through
And where does this AC come from?
To turn the LED red, pin1 is set HIGH and pin2 is set low, so the power goes one way. To turn it green, the polarity of the two pins is swapped, so the power goes the other way. Yellow is produced by rapidly switching between red and green, producing AC. The AC doesn't come from a 60Hz wall outlet, but is manually generated by the Arduino.

I hope that's clear; if it's not I can try to explain it better.
25  Development / Other Software Development / New Library for BiColor LEDs on: August 01, 2012, 10:38:26 am
I just wrote and uploaded a new library for controlling bicolor LEDs. It lets you drive both solid colors, as well as allowing you to put the two together "simultaneously" by passing AC current through, rapidly turning on one color, then the other.
Downloads & more info can be found at http://arduino.cc/playground/Code/BiColorLED.
This thread is for general discussion of the library itself. Post bugs, suggestions, comments, etc. here.
26  Using Arduino / Programming Questions / Re: How can I upload to my Arduino without compiling? on: July 31, 2012, 01:14:36 pm
Quote
...less than an hour.
Wow, that's some huge program!  smiley-razz
3ms is less than an hour. Just thought I'd point that out.

I find myself in the same situation as the original poster sometimes: I have to wait for the whole sketch to recompile because I forgot to plug in the board. Is there any way to get the basic Arduino IDE to only compile/link the parts that have changed? This would also be useful for compiling sketches with multiple files: if you haven't changed the file, it doesn't need to recompile.
27  Using Arduino / Programming Questions / Re: Unexpected error in .h file of custom library on: July 31, 2012, 12:43:31 pm
Blech... so that's what it was. Thanks for your quick reply. I don't like the C preprocessor--it does things like that to me and I don't notice.
28  Using Arduino / Programming Questions / [SOLVED] Unexpected error in .h file of custom library on: July 31, 2012, 12:33:56 pm
I'm new to C++ and Arduino libraries, so I have no clue what's wrong here. I'm making a library to drive a bicolour LED, based on some Processing code I wrote.
Here's the code:

BiColorLed.h
Code:
#ifndef BiColorLED
#define BiColorLED 1

#include "WProgram.h"

class BiColorLED{
public:
BiColorLED(uint8_t ledPin1, uint8_t ledPin2);
void drive();
void setColor(uint8_t toColor);
private:
uint8_t color;
uint8_t pin1, pin2;
bool yellowRed;
};
  
#endif
BiColorLed.cpp
Code:
#include "BiColorLED.h"

BiColorLED::BiColorLED(uint8_t ledPin1, uint8_t ledPin2) {
pin1=ledPin1;
pin2=ledPin2;
color=0;
yellowRed=false;
}

void setColor(uint8_t toColor) {
color=toColor;
drive(); // Change the color
}

void drive() {
// TODO blinking goes here
if (color == 3) { // Yellow
color = (yellowRed?1:2);
yellowRed = !yellowRed;
} // Beyond this point the color is always red, green, or black
// Actual LED driving
if (color == 1) { // Red
digitalWrite(pin1, HIGH);
digitalWrite(pin2, LOW);
} else if (color == 2) { // Green
digitalWrite(pin1, LOW);
digitalWrite(pin2, HIGH);
} else { // Black
digitalWrite(pin1, LOW);
digitalWrite(pin2, LOW);
}
}

And, just for completeness, my sketch:
Code:
#include <BiColorLED.h>
void setup() {}
void loop() {}

The .h and .cpp files are largely based off of looking at other libraries. Now, here's the problem: when I verify the sketch, the Arduino IDE comes back with:
Code:
In file included from BareMinimum.cpp:1:0:
/home/wolf/sketchbook/libraries/BiColorLED/BiColorLED.h:6:7: error: expected identifier before numeric constant
/home/wolf/sketchbook/libraries/BiColorLED/BiColorLED.h:6:7: error: expected unqualified-id before numeric constant

As near as I can tell, this means that there's a problem between the words `class' and `BiColorLED'. This line is copied verbatim from another library with a change of class name, so I can't figure out what's wrong. Any ideas?
Pages: 1 [2]