Show Posts
Pages: 1 ... 376 377 [378] 379 380 ... 542
5656  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.
5657  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
5658  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.
5659  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)



5660  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.
5661  Using Arduino / Displays / Re: How to select cursor position on a specific VFD on: February 01, 2012, 12:32:42 pm
My guess is that, since several "+" values are listed after the "Escape" command 0x1B) you probably send 0x1B,0x43, and then the desired cursor position.  You just have to figure out what the format of the position is.  My first guess would be one byte for Row and one byte for Column.
5662  Using Arduino / Installation & Troubleshooting / Re: Blink sketch not working on: February 01, 2012, 12:23:40 pm
I changed the lfuse to 0xee, which should be low power crystal oscillator 8-16 Mhz and divide clock by 8 unprogrammed. Installed 16 Mhz crystal and LED circuit from pin 13 to ground.

If you want to use that Arduino IDE you should probably set the fuses to match one of the existing Arduino boards:
Arduino Duemilanove: hfuse=0xDA, lfuse = 0xFF, efuse=0x05
Arduino UNO:             hfuse=0xDE, lfuse = 0xFF, efuse=0x05 (smaller bootloader)
5663  Using Arduino / Programming Questions / Re: Linear Photodiode Array with manual Shift Register on: February 01, 2012, 12:05:27 pm
even some of them (for example the Photo Gate) are requiring voltages of HIGH: +8 and LOW: -4

How would I do that?

You could get close by adding another 3v cell with the + side to ground.  Then a pot between -3 and +9 would give you an adjustable voltage that covers most of the desired range.  That would work if you don't need to adjust that gate dynamically.
5664  Using Arduino / Installation & Troubleshooting / Re: Blink sketch not working on: February 01, 2012, 10:08:58 am
Are you SURE it was not running?  If you use an off-the-shelf ATmega328P and don't change the flags it will run at 1 MHz.  That would mean your Blink sketch would toggle every 16 seconds.  Burning the bootloader with the Arduino IDE takes care of switching to the external 16 MHz clock and pre-scale of 1 rather than the default internal 8 MHz clock and pre-scale of 8.
5665  Using Arduino / Programming Questions / Re: Linear Photodiode Array with manual Shift Register on: February 01, 2012, 10:03:27 am
The spec says that some of the gates need 8V +/-10% (7.2V to 8.8V). The 5V from the Arduino might not be sufficient.  Perhaps you need some level shifting.
5666  Using Arduino / Installation & Troubleshooting / Re: Mac Serial Port ID on: February 01, 2012, 09:45:56 am
You need to install the latest Virtual Communication Port drivers from FTDI:

http://www.ftdichip.com/Drivers/VCP.htm

Note: V2.2.16 works fine with Mac OS X 10.7 (Lion) even though the installation package is named:  FTDIUSBSerialDriver_10_4_10_5_10_6.mpkg
5667  Using Arduino / Sensors / Re: MMA7361 Triple Axis Accelerometer Sensor Module on: February 01, 2012, 09:38:39 am
Did the company you bought it from provide any useful information?  A schematic diagram would be nice.

I suspect that GND and 5V are the power inputs and 3V3 is regulated 3.3V from the onboard regulator.

X, Y and Z are probably voltages proportional to acceleration.  You can hook them to Arduino analog inputs.   Reading the MMA7361 datasheet should tell you what voltages to expect.

0G is probably an "I'M IN FREE_FALL!" output (typically used in laptops to retract hard-disk heads in a fall)

GSEL, ST and SLP are probably control signals.  Reading the MMA7361 datasheet should tell you how they work.
5668  Using Arduino / Sensors / Re: how to use Nitric Oxide sensor in Arduino on: February 01, 2012, 09:24:55 am
This application note from the manufacturer gives background information on how the sensors work:

http://www.alphasense.com/pdf/AAN_104.pdf


This application note from the manufacturer will help with designing a circuit:

http://www.alphasense.com/pdf/AAN_105-03.pdf

5669  Using Arduino / Project Guidance / Re: Did I forget anything?- 72 LED Array loop cycle for 6 months. on: February 01, 2012, 09:02:43 am
I think that because the Base/Emitter junction acts a a diode straight to Ground you are supposed to have a resistor between the Arduino pin and Base to limit the current draw.  You don't need much current because the transistor has 'gain' (switches more current than comes in the Base).  A 1K resistor (5 mA current) sounds about right.
5670  Using Arduino / LEDs and Multiplexing / Re: 74HC… are all the same? on: February 01, 2012, 08:55:40 am
4021   8 Stage Static Shift Register

Is what I'm looking for? (a shift register equivalent to the 74HC595?)

The 4021 is a parallel-in/serial-out shift register.  It's useful for extending the number of switch inputs to an Arduino but not for extending the number of outputs.

The 4015 (Dual 4-Stage Static Shift Register) is a parallel-out shift register (closer to what you want).  It has two 4-bit stages which can be chained together to make one 8-bit shift register.
Pages: 1 ... 376 377 [378] 379 380 ... 542