Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Troubleshooting / Ethernet client.read() timeout? on: December 20, 2010, 02:48:19 pm
Hello everyone, i'm programming a server/client program. My arduino will be server. My question is if there is a time out in client.read?if not how can i make one? my problem is here:

1)client sends 2 bytes
2)server(arduino) reads first, makes some checks to see what was the command
3)and then reads the second byte but sometimes read() returns -1

if i delay() the second read in server no problem!!! i need i time out in read to wait for reading unti a byte come but not forever.
thanks
2  Forum 2005-2010 (read only) / Exhibition / Re: SD card read/write with Arduino on: January 22, 2011, 07:50:41 pm
Hello everyone! I have an arduino mega(atmega2560)+ ethernet shield+sd card http://www.arduino.cc/en/Main/ArduinoEthernetShield

To make the lib sd_raw work on my mega i added the following lines
in sd_raw_config.h where is checking for platform definitions.

Code:
#elif defined(__AVR_ATmega2560__)
      #define configure_pin_mosi() DDRB |= (1 << DDB2)
    #define configure_pin_sck() DDRB |= (1 << DDB1)
    #define configure_pin_ss() DDRB |= (1 << DDB0 )
    #define configure_pin_miso() DDRB &= ~(1 << DDB3)

    #define select_card() PORTB &= ~(1 << PB0)
    #define unselect_card() PORTB |= (1 << PB0)

without this i get error
Code:
   #error "no sd/mmc pin mapping available!"

i hope that help arduino atmega2560 users
Pages: [1]