Show Posts
Pages: 1 ... 373 374 [375] 376 377 ... 542
5611  Using Arduino / Programming Questions / Re: Trouble with counter on: February 05, 2012, 05:42:47 am
And don't forget to declare init_counter to be 'volatile'.
5612  Using Arduino / Programming Questions / Re: Isolating latitude and logitude values from GPS data on: February 05, 2012, 05:35:02 am
Replace:
Code:
        for (int i=0;i<12;i++){
           switch(i){
             case 0 :Serial.print("Time in UTC (HhMmSs): ");break;
             case 1 :Serial.print("Status (A=OK,V=KO): ");break;
             case 2 :Serial.print("Latitude: ");break;
             case 3 :Serial.print("Direction (N/S): ");break;
             case 4 :Serial.print("Longitude: ");break;
             case 5 :Serial.print("Direction (E/W): ");break;
             case 6 :Serial.print("Velocity in knots: ");break;
             case 7 :Serial.print("Heading in degrees: ");break;
             case 8 :Serial.print("Date UTC (DdMmAa): ");break;
             case 9 :Serial.print("Magnetic degrees: ");break;
             case 10 :Serial.print("(E/W): ");break;
             case 11 :Serial.print("Mode: ");break;
             case 12 :Serial.print("Checksum: ");break;
           }
           for (int j=indices[i];j<(indices[i+1]-1);j++){
             Serial.print(linea[j+1]);
             //lat=indices[2];
           }
 

With something like:
Code:
    String lat = "", long = "";

    for (int j=indices[2];j<(indices[3]-1);j++){
         lat += linea[j+1]);

     for (int j=indices[4];j<(indices[5]-1);j++){
         long += linea[j+1]);
   
5613  Using Arduino / Programming Questions / Re: Strange error... and I don't know if it's my own... on: February 05, 2012, 05:17:47 am
The problem is this line:
Code:
#define l 10

When that gets in before:
Code:
uint16_t makeWord(byte h, byte l);
that line gets interpreted as:
Code:
uint16_t makeWord(byte h, byte 10);  // Syntax problem caused by text substitution.

The fix, and generally better programming practice, is to use a constant integer:
Code:
const int l = 10;
5614  Topics / Robotics / Re: maximum number of servos? on: February 04, 2012, 07:34:14 pm
From the library reference:

"The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. "
5615  Using Arduino / Programming Questions / Re: Strange error... and I don't know if it's my own... on: February 04, 2012, 07:28:32 pm
Because Arduino puts some declarations at the top of your compile, line numbers displayed with error messages are usually one higher than the line number in your code.   If you provide all of the code perhaps someone can determine how to get it compiled.

Are you using Arduino 1.0?  Wprogram.h was replaced with Arduino.h in 1.0.
5616  Using Arduino / Sensors / Re: Interfacing two "SPI" sensors with Arduino. on: February 04, 2012, 07:17:24 pm
Another option is to use software SPI to talk to the device that doesn't implement the Slave Select.
5617  Using Arduino / Networking, Protocols, and Devices / Re: I2C - Write as Slave on: February 04, 2012, 07:12:35 pm
You have to implement the "onReceive()" handler to handle incoming messages from the Master and the "onRequest()" handler which gets called when the Master does a requestFrom().
5618  Using Arduino / Sensors / Re: how to use a mma7361 accelerometer what is wrong? on: February 04, 2012, 07:03:57 pm
SL is the SLEEP signal.  Connect it to 3.3V or the accelerometer will stay in a low-power sleep mode.
5619  Topics / Home Automation and Networked Objects / Re: Reading a Script from Memory on: February 04, 2012, 06:50:37 pm
I may not have been totally clear.  I'd like to write a script from my computer, send it to the Arduino, then with the use of an external power supply have the Arduino perform the functions from the script.

This sounds remarkably like writing a sketch, uploading it to the FLASH memory of the Arduino, and executing it whenever the Arduino is provided power.  That's what an Arduino does.  Any Arduino will do that.  Provide power and it runs the last sketch you uploaded.
5620  Using Arduino / Networking, Protocols, and Devices / Re: ATiny on: February 04, 2012, 06:46:14 pm
The internal RC oscillator can be calibrated so that should not be a problem.

SoftwareSerial.cpp has settings up to 115200 baud, even for an 8 MHz clock.  Slower rates would be less prone to error but I expect 9600 would be plenty safe.
5621  Using Arduino / Audio / Re: HELP!!! Problem with ADC sample interval timer on: February 04, 2012, 06:38:57 pm
How did you arrive at 9259 full 10-bit samples per second. Sorry to sound like a bit of a noob.

To get 10-bit samples you have to use an ADC clock slower than 200 KHz.  When the system clock is 16 MHz (like on the Arduino) the only way to get the ADC clock below 200 KHz is to use the "divide by 128" pre-scaler.  To determine the sample rate you divide the ADC clock rate by 13.5: the number of cycles per sample in 'free running' mode where it takes successive samples as quickly as it can.

16,000,000 / 128 = 125,000 / 13.5 = 9259.259259...
5622  Using Arduino / Audio / Re: HELP!!! Problem with ADC sample interval timer on: February 04, 2012, 12:45:30 pm
The minimum analog reference value is 1.0V.  Not sure what it does if you try to use 0.5V.

You can't get 40,000 10-bit samples per second.  To get 10-bit samples you have to keep the ADC clock below 200 KHz which will get you less than 16000 samples per second (13.5 cycles per sample).  If you push faster than that the low-order bits will not be accurate.

The available clock divisors are 128, 64, 32, 16, 8, 4, and 2.  These give the following clock speeds on a 16MHz Arduino:
128 -> 125 KHz -> 9,259 FULL 10-bit samples per second
64 -> 250 KHz -> 18,518 short samples per second
32 -> 500 KHz -> 37,037 short samples per second
16 -> 1 MHz -> 74,074 short samples per second
8 -> 2 MHz -> Not supported
4 -> 4 MHz -> Not supported
2 -> 8 MHz -> Not supported
5623  Using Arduino / Networking, Protocols, and Devices / Re: ATiny on: February 04, 2012, 12:14:30 pm
I don't think the ATtiny45 or ATtiny85 has a serial port.  You might be able to port a SoftwareSerial library to work on one of them and use that to communicate with your computer.
5624  Topics / Home Automation and Networked Objects / Re: Reading a Script from Memory on: February 04, 2012, 01:00:02 am
> 1) Power arduino + other devices

This can be done with a battery or a power supply that runs off house current.


> 2) Arduino reads script from memory

That's what a 'sketch' is: A script, in memory.


> 3) Functions are performed

That's what a sketch is:  A script, in memory, that performs functions.


> What hardware other than arduino do I need to accomplish this?   

The afore-mentioned battery or power supply.


> And, how do I include this in my script?

It's not clear what you mean by 'this'.  It will probably require programming.
5625  Using Arduino / LEDs and Multiplexing / Re: Would 10K pullups be okay for servos controlled by a TLC5940? on: February 04, 2012, 12:43:12 am
You could use two 10K's in parallel to make a 5K.
Pages: 1 ... 373 374 [375] 376 377 ... 542