Show Posts
Pages: 1 2 3 [4] 5 6 ... 287
46  Using Arduino / Programming Questions / Re: Using millis on: August 07, 2014, 07:49:42 pm
Please use code tags when posting code. Here's how:
http://forum.arduino.cc/index.php/topic,148850.msg1118324.html#post_codetags

As Paul said, millis() returns an unsigned long integer, therefore all variables that might contain a value returned from millis() should be unsigned long.

Back to the original post, I thought the goal was to eliminate calls to delay()?
47  Using Arduino / General Electronics / Re: Wiring Arduino Micro with Xbee Radio on: August 07, 2014, 08:13:00 am
Hi,

May I know whether anything would be added in the circuit given by Jack Christensen at pin DOUT of Xbee if I wanted to receive data at my Arduino Leonardo? (pin DOUT is connected to Rx pin of Arduino)

Using the circuit on breadboard#1, I could send data from Xbee#1 to Xbee#2. Xbee#2 was connected to my laptop by a Xbee Explorer. I moved Xbee#2 to breadboard#2 and connected Xbee#2 to an Arduino Leonardo (I reused the circuit given by Jack). I could not receive data at Xbee#2.

Does anyone have any suggestion? Tks a lot.

It should work the same. Surely XBee #2 must still be receiving the data, assuming it is powered and connected correctly. Else it must be a code issue. The Leonardo is reading the XBee on Serial1, correct?
48  Using Arduino / General Electronics / Re: Gauging Interest: Printed Circuits on Paper on: August 06, 2014, 09:11:21 pm
Jack, the traces that go nowhere are likely SMD pads. I don't know if that particular board is double-sided or not, I do know that people are making double-sided boards by inkjet, toner transfer, and photoresist.

The SMD pads are pretty obvious, I meant the other ends that just seem to go nowhere, like these:
49  Using Arduino / Programming Questions / Re: Why does digitalWrite disable global interrupts before changing a pin state? on: August 06, 2014, 08:25:14 pm
out is pointer to an IO register, which is volatile.  It can change other than by program action.  If you output to it twice, you want to output to it twice, and not just with the last value.  (hopefully the "volatile" is in the right place and means "this is a pointer to a volatile value", rather than "this is a volatile pointer to a value."  You have to be careful with that...)

Thanks, that makes sense. Found a decent explanation of the various permutations here, so it does appear to be coded correctly. Oy. smiley-eek-blue
50  Using Arduino / General Electronics / Re: Gauging Interest: Printed Circuits on Paper on: August 06, 2014, 06:58:54 pm
Here are some samples of boards that members of my Yahoogroups have made using Inkjet resist printing. The soldermask/component legend is also inkjet printed.

That is impressive resolution. Is this a double-sided board (wondering about the traces that seem to go nowhere)? How do vias work with this process?
51  Using Arduino / Programming Questions / Re: Why does digitalWrite disable global interrupts before changing a pin state? on: August 06, 2014, 06:17:27 pm
Ok, I think I got it.  So calling
Code:
out = ~bit;
would be atomic, but doing the and with itself makes it 2 operations, so it's not atomic.  Is that right?  

I doubt that'd be atomic. The reason that PORTB |= _BV(PORTB5) is atomic is because the compiler is smart enough to boil it down to a single SBI instruction. Note that in this case, the right hand side of the assignment is a known constant at compile time. Make it a variable and it pretty much has to be more than one instruction then.

I'm not sure why out is volatile, nor am I sure that it has to be.
52  Using Arduino / Programming Questions / Re: Why does digitalWrite disable global interrupts before changing a pin state? on: August 06, 2014, 05:24:29 pm
The compiler will recognize the idioms, e.g.

Code:
PORTB |= _BV(PORTB5);
PORTB &= ~_BV(PORTB5);

and generate single sbi or cbi instructions. This does not apply to all ports on the larger MCUs such as the ATmega2560 that have some of their ports above location 0x1F, but will work on the ATmega328P, ATmega1284P, and various ATtinys.
53  Using Arduino / Programming Questions / Re: Why does digitalWrite disable global interrupts before changing a pin state? on: August 06, 2014, 04:43:29 pm
Because

Code:
*out &= ~bit;
//and
*out |= bit;

are not atomic operations. Basically the PORT register is loaded, modified using AND or OR, then stored. If some ISR were also modifying the same register, the change could be lost.
54  Community / Bar Sport / Douglas Adams would be proud on: August 06, 2014, 02:22:31 pm
Or maybe not. Anyway, the local athletic club is installing one of these:
http://www.toweltracker.com/

Now we are tracking individual towels with RFID.
55  Using Arduino / Project Guidance / Re: Measuring Arduino Power Consumption on: August 06, 2014, 09:34:45 am
If the Uno is powered by USB, almost certainly it is not the Uno's current that is being measured. The description is still insufficient, hence the request for a diagram. Schematic diagrams are the standard worldwide accepted method of communicating circuit design, so it's a good idea to get comfortable with them.
56  Using Arduino / Networking, Protocols, and Devices / Re: how to wake up arduino by rtc DS1307 on: August 06, 2014, 07:54:48 am
I cannot find a DS3221 library that has the alarm setting commands you would require but maybe someone else knows of one.

I humbly submit this one:
https://github.com/JChristensen/DS3232RTC
57  Using Arduino / Project Guidance / Re: Measuring Arduino Power Consumption on: August 06, 2014, 07:51:42 am
Am I measuring the current draw incorrectly?  

I'd say so.

Quote
Any guidance would be appreciated

Show us how you are measuring the current. A diagram would be best even if just drawn by hand.

FYI, here are measurements I've done:
http://forum.arduino.cc/index.php?topic=164146.msg1232507#msg1232507
58  Using Arduino / Networking, Protocols, and Devices / Re: Trouble with both DS1307 and DS3231 RTCs and time slowing down on: August 06, 2014, 07:38:35 am
I need a proxy, it costs me money to reply due to my ip ban.

Ok so it's nothing to do with it's internal resistance. .. but I remember leaving it for a couple of weeks, the coin cell drifted while the nokia battery was perfect.. maybe my coin cell was really low on voltage?

Could be, I might have checked it with a meter. Was the RTC being powered only by the backup battery, or did this occur while the RTC was powered by VCC? If the latter, it shouldn't matter what the state of the battery was. The RTCs that I use say that if a backup battery is not used, the VBAT pin should be connected to ground. I've also seen it said that if a backup battery is used, then one has to be present, even if it's dead, for the RTC to operate properly on VCC. Haven't checked that myself, though.
59  Using Arduino / Networking, Protocols, and Devices / Re: Trouble with both DS1307 and DS3231 RTCs and time slowing down on: August 06, 2014, 12:03:49 am
Use a lithium phone battery as it's backup power source instead of a coin cell...

When I did that, I went from losing seconds a day to seconds a month!

And what do you attribute that to?

It's odd that I've never noticed any trouble with coin cells.


Purely observational... but it's a true story, kinda leads me to believe the battery's internal resistance plays a part.

It may be a true story, but that's not a conclusion that I could accept. It can't be internal resistance, something else must have been going on. These RTCs only draw nanoamps from the backup batteries, and then only when Vcc is not present. My Microchip RTCs use a 1000Ω resistor in series with the coin cell, and this drops less than a millivolt because the current is so low.

Coin cells work fine with RTCs and they last for years due to the low load.
60  Using Arduino / General Electronics / Re: Gauging Interest: Printed Circuits on Paper on: August 05, 2014, 10:07:01 pm
I'll be interested to hear how it goes.
Pages: 1 2 3 [4] 5 6 ... 287