Show Posts
Pages: 1 ... 373 374 [375] 376 377 ... 540
5611  Using Arduino / Microcontrollers / Re: Bootloader for 328 with external 8MHz crystal on: February 02, 2012, 09:19:29 pm
You could try burning the existing bootloader for an 8MHz 328:  "LillyPad Arduino w/ ATmega328"  If that works, your optiboot build might be the problem.
5612  Using Arduino / Microcontrollers / Re: aTmega328s so fragile??? on: February 02, 2012, 09:05:44 pm
If you think thats cheap, try $5. http://www.ebay.com/itm/USB-ISP-Programmer-ATMEL-AVR-51-ATMega-ATTiny-/290592019943?pt=BI_Electrical_Equipment_Tools&hash=item43a8a255e7
Note, I have no experience with these but for $5 I will probably give it a shot smiley

Hmm..  It says "Can not programme Bootloader procedure of AVR single chip" and they don't list the ATmega328 or 328P as supported. ?!?
5613  Using Arduino / Sensors / Re: Need to have Arduino Uno talk with Analog ADXRS453 digital gyro on: February 02, 2012, 12:19:23 pm
Im currently working on the same Gyroscope, but I have run into some problems during the init of the sensor.
Have you got it working or just have been reading the datasheet?

Just reading the datasheet.
5614  Using Arduino / Installation & Troubleshooting / Re: Problem with my first sketch uploading on: February 02, 2012, 12:17:23 pm
Time to try a loopback test to see if the USB-to-Serial chip is working.

http://arduino.cc/forum/index.php/topic,73748.0.html
5615  Using Arduino / Project Guidance / Re: When to use which wiring.c files on: February 02, 2012, 12:08:43 pm
Code:
unsigned long duration = 3600000UL;
// capture the starting time
unsigned long endTime = millis() + duration;
// then see if enough time elapsed:
if (millis() - endTime < 0){
// do something
}

One major problem there.  Since millis() and endTime are both unsigned, the result of the subtraction will never be less than 0.

You might try to fix that with this:
Code:
if (millis() > endTime){
// do something
}

That works until millis() gets up to about  0xFCA00000... then endTime = millis() + duration; wraps around and produces a small number.  For the next hour millis() will ALWAYS be greater than endTime.  So every ~47 days your code will go crazy for an hour. smiley

The only thing that works is (millis() - previousTime > interval).  Sorry.
5616  Using Arduino / Microcontrollers / Re: aTmega328s so fragile??? on: February 02, 2012, 11:58:19 am
Have you spent enough on your cheap programming setup to think maybe you should have bought one of the $10 USBASP programmers yet? 

I've had luck with ArduinoISP but I just bit the bullet and blew $9.80 on the USBASP.  Thanks for the pointer. smiley
5617  Using Arduino / Project Guidance / Re: When to use which wiring.c files on: February 01, 2012, 05:42:46 pm
Code:
unsigned long startTimer = 0;

void loop()
   {
   unsigned long currentTime = millis();
   if (currentTime - startTimer > 60UL*60UL*1000UL)  // 1 hour in milliseconds
       {
       //  This executes 1 hour after the Arduino starts
       startTimer = currentTime;  // And again every hour after that.
       }
    }

If you want the Arduino to just do nothing for an hour:  delay(60UL*60UL*1000UL);

Note: Timer0 does not interrupt every millisecond (16,000 cycles).  From wiring.c: "// the prescaler is set so that timer0 ticks every 64 clock cycles, and the overflow handler is called every 256 ticks."  So that's 16384 cycles or 1.024 milliseconds.
5618  Using Arduino / Microcontrollers / Re: Fused to low frequency external crystal CKDIV 8 ... argh on: February 01, 2012, 05:26:48 pm
Have you tried using the Arduino IDE "Burn Bootloader" process on it?  That will do a Chip Erase which will reset all the fuses.
5619  Using Arduino / Microcontrollers / Re: aTmega328s so fragile??? on: February 01, 2012, 05:15:45 pm
The schematic says: "Target AVR supplies power to the dongle: So make sure the target is powered on (5V)."

What was powering the AVR?
5620  Using Arduino / Networking, Protocols, and Devices / Re: Remote connection getting closed - hitting an arbitary URL? on: February 01, 2012, 05:03:57 pm
Looks like the web server is expecting a username and password.  I'm guessing that you entered that data in your browser the first time you connected to the camera and your browser remembers your login information.  The URL syntax is:

http://<username>:<password>@<webcam ip address>/camera_control.cgi?user=user&password=password&command=<command>
5621  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet Server expects client data first on: February 01, 2012, 04:41:38 pm
I think your problem is the definition of server.available():

"Gets a client that is connected to the server and has data available for reading."

The code looks like this:
Code:
EthernetClient EthernetServer::available()
{
  accept();

  for (int sock = 0; sock < MAX_SOCK_NUM; sock++) {
    EthernetClient client(sock);
    if (EthernetClass::_server_port[sock] == _port &&
        (client.status() == SnSR::ESTABLISHED ||
         client.status() == SnSR::CLOSE_WAIT)) {
      if (client.available()) {
        // XXX: don't always pick the lowest numbered socket.
        return client;
      }
    }
  }

Maybe you can write something like this:

Code:
void sendAll(unsigned myPort, String text_to_send)
{
  for (int sock = 0; sock < MAX_SOCK_NUM; sock++)
    {
    EthernetClient client(sock);
    if (EthernetClass::_server_port[sock] == myPort &&
        (client.status() == SnSR::ESTABLISHED ||
         client.status() == SnSR::CLOSE_WAIT))
        {
        client.print(text_to_send);
        client.stop();  // Close the client connection
        }
    }
}

On further looking it appears that server.write(buffer, size) does almost exactly that except it doesn't close the client.  If your client will close the connection after it receives the text you can use server.write().  Not sure how long to wait between calls to .write() to give the client a chance to close the connection before it gets the string again.
5622  Using Arduino / Installation & Troubleshooting / Re: Problem with my first sketch uploading on: February 01, 2012, 04:22:21 pm
If your Arduino has an FTDI chip (everything before UNO and Mega) you need to install the FTDI driver.

http://www.ftdichip.com/Drivers/VCP.htm
5623  Using Arduino / Project Guidance / Re: When to use which wiring.c files on: February 01, 2012, 04:17:39 pm
> There are many wiring_xxx.c or .h files supplied with arduino 1.0.  Without searching through each
> one to create my own index, how do I tell when I need one on more?

All are included as part of the automatic include of Arduino.h.

> If I change wiring.c do I need to explicitly pre-compile it

No.  All of the 'core' files are compiled each time they are needed.  If you think you need to edit the Arduino core to get something done it usually means that you are trying to do something the hard way.  If you need a timer it's probably best to use one of the OTHER timers rather than Timer0 which the Ardiuno core uses.

> How do I know the compiler will use SIGNAL(TIM0_OVF_vect) from my copy instead of the same named SIGNAL(TIM0_OVF_vect) from the original wiring.c?

Use one of the other timers.
5624  Using Arduino / Programming Questions / Re: HELP!How to set Software Seial 7 bits data, Even Parity, 1 stop bit? on: February 01, 2012, 12:56:26 pm
7-bit Even Parity is just like 8-bit, No Parity except the high bit is determined from the other 7 on send and receive.  You could re-write any of the software serial libraries or you could do it in software:

For each byte to be sent:
   Count the 1 bits in the bottom 7 bits of the byte.
   if the count is odd, set the top bit to 1, else set it to 0
   send the byte.

You can similarly check the parity on received bytes or just mask the parity bit off:  (byte & 0x7F)



5625  Using Arduino / Interfacing w/ Software on the Computer / Re: Burning .hex files to avr using 10 pin ISP header in arduino (nepaluino) on: February 01, 2012, 12:48:34 pm
First you'll have to determine if the 10-pin ISP header has the same six signals as the Arduino ISP header.  To do that you will either need a schematic (none to be found on nepaluino.com) or you will need to trace the circuits.

Good luck.
Pages: 1 ... 373 374 [375] 376 377 ... 540