Show Posts
Pages: 1 ... 2148 2149 [2150] 2151 2152 ... 3356
32236  Using Arduino / Programming Questions / Re: I want to run my atmega328 on batteries, power consumption has to be lowered on: January 16, 2012, 07:24:35 pm
Quote
but then I get "Wire.send() has been renamed Wire.write()" which is fine, but changing it to Wire.write() gives me this error message "call of overloaded 'write(int)' is ambiguous".
Probably because the code contains something like:
Code:
Wire.write(0);

Change that to
Code:
Wire.write((byte)0);
32237  Using Arduino / Programming Questions / Re: Time library tmElements_t time_t tm on: January 16, 2012, 07:22:38 pm
That is a symbol that you can define to enable populating a variable that records how far the clocks have drifted. I'm not sure what use you'd make of that data. Perhaps if the drift is consistently small, you might opt to increase the sync interval, especially if syncing from an NTP server.
32238  Using Arduino / Programming Questions / Re: simple script, trying to learn on: January 16, 2012, 07:14:17 pm
The real problem is that this:
Code:
if (varVal % 10)
should be
Code:
if (varVal % 10 == 0)
Without the == 0, the varVal%10 evaluates to true or false, which is not what we intended.
32239  Using Arduino / Programming Questions / Re: Time library tmElements_t time_t tm on: January 16, 2012, 07:11:38 pm
Quote
As far as I know the Arduino has no clock? (that's why I've attach an RTC).
True. But it has a second hand, so if you tell it the second, minute, hour, day, month,and year, it can do a reasonable job of keeping time.

Quote
But if now() is reading this system/Arduino time I guess it must have the ability to keep clock time once it's been initialised?
Not terribly accurately, and not across resets, which are the real reasons for an RTC.

Quote
Perhaps there is some relationship here between system/arduino time and millis()?
There is.

Quote
and what did you mean by "it would [work] if you are syncing with the RTC regularly".
The Arduino doesn't keep real accurate time. Your RTC does. Periodically, the Arduino should ask the RTC what time it is. This is called syncing.

The setSyncProvider() function is used to define what function to call whenever a sync is required. Generally, you would specify some RTC function, like RTC.get().

Use setSyncInterval() to define how often to sync.

Look at the examples...
32240  Using Arduino / Programming Questions / Re: Using SoftwareSerial library and TinyGPS libraries on a UNO with GPS Shield on: January 16, 2012, 07:00:13 pm
Try adding ", true" to the end of the SoftwareSerial constructor. Perhaps the data output by the GPS is inverted.
32241  Using Arduino / Programming Questions / Re: Help LED sequencing sketch on: January 16, 2012, 06:58:38 pm
Quote
What did I miss?
Serial.begin() in setup() and Serial.print() statements in loop() and lightMyFire(). For you to debug the code is going to be orders of magnitude faster than for us to do it.
32242  Using Arduino / Programming Questions / Re: simple script, trying to learn on: January 16, 2012, 06:56:31 pm
Quote
well it just lists every number as a new line, which means its dividing everything by 10, except 11, 21, 31 etc, which is odd
We need to see what you put in the if block and what you put in the else block. It should look like:
Code:
if(varVal % 10)
{
  Serial.println(varVal, DEC);
}
else
{
  Serial.print(varVal, DEC);
  Serial.print(" ");
}
32243  Using Arduino / Programming Questions / Re: Time library tmElements_t time_t tm on: January 16, 2012, 06:53:08 pm
Quote
but what IS this mythical “system time”???
The time that Arduino is aware of.

Quote
for example the following code appears in timeRTCset, and both must be executed or it doesn’t work:
It would if you are syncing with the RTC regularly.

Quote
I found the “maketime” routine in Time.cpp which takes time elements as input and outputs time_t. If I could access this my problem would be resolved, but I haven’t figured this out
The tmElements_t object is a structure. You can create an instance of the structure, populate the members of the structure, and then pass the structure to makeTime.

However, the easiest way to do it is to call setTime() with the values that you want, then call now() which also returns a time_t object that you call RTC.set() with.

Code:
setTime(9,30,50,13,1,2012);
time_t t = now();
RTC.set(t);
32244  Using Arduino / Programming Questions / Re: Help LED sequencing sketch on: January 16, 2012, 06:33:18 pm
Quote
I want the LED to stay on, when the button is pushed this LED goes out and the next one in the sequence is illuminated  and so on through the sequence.
To have a momentary contact switch turn an LED on, and have it stay on when the switch is released is trivial. When the switch reads HIGH, turn the LED on. When it reads LOW, don't turn the LED off. Just remove the else block containing the call to allOff().

32245  Using Arduino / Programming Questions / Re: simple script, trying to learn on: January 16, 2012, 06:29:35 pm
Quote
can i do math?
I don't know. The Arduino can, though.

Quote
such as im just playing with this script now, and ive made it make a new line when varVal == 10, and then set the value to 0
Code:
if(varVal >= 10)
  varVal = 0;

Quote
can i make it work out if its a multiple of 10 and then make a new line to keep counting?
Code:
if(varVal % 10)
{
   // varVal is a multiple of 10...
}
32246  Development / Other Software Development / Re: Frequency / period counter on: January 16, 2012, 06:27:05 pm
Quote
Wprogram.h is included in Arduino by default.
With versions 0023 and earlier, that is. With 1.0, that file was renamed to Arduino.h. The conditional/unconditional inclusion is how you can tell if a library is compatible with 1.0. Conditional is; unconditional is not.
32247  Development / Other Software Development / Re: multiple bugs in ethernet library on: January 16, 2012, 06:23:52 pm
I'd debug this by creating a function to replace all calls to client.print(). In the new method, do a client.print() and a Serial.print() with the same data. If the serial monitor shows the data correctly, but the browser does not, upgrade to Firefox.

If both are wrong, fix your code.
32248  Development / Other Software Development / Re: trouble with "Arduino.h" on: January 16, 2012, 06:16:01 pm
Quote
The fat that init() does lots of system setup leads me to steer clear of it precisely because I don't want to sort through every nuance of init() to determine what's safe or what's not.
Exactly. Plus, you don't want to have to do that with every new version of the IDE.
32249  Development / Other Software Development / Re: multiple bugs in ethernet library on: January 16, 2012, 05:59:03 pm
Quote
if i use EthernetClient.write() it works fine, code gets a bit ugly because the String class don't have a function to gain direct access to the internal buffer.
The String class has a toCharArray() method to get the whole array and a charAt() method to get one character. Use a for loop to get one character at a time, or make a copy of the whole buffer.

Better yet, quit using the String class. People wrote extensive text processing applications for decades before the String class wrapped the C code that really does all the work.
32250  Development / Other Hardware Development / Re: lol where can I get this ?? on: January 16, 2012, 05:54:55 pm
Quote
Currently, our relationships with such OEM
customers are stricly confidential,
Which means that they are still trying to find one.
Pages: 1 ... 2148 2149 [2150] 2151 2152 ... 3356