hi
i am trying to generate a random number in the ftp code, but it alwaysgives the same 26807 result
i used randomseed(analogRead(A0)), in setup and in the loop, no changes
please help
here is the part of my code
void setup()
{
Serial.begin(9600);
randomSeed(analogRead(A0));
digitalWrite(10,HIGH);
if(SD.begin(4) == 0)
{
Serial.println(F("SD init fail"));
}
Ethernet.begin(mac, ip);
digitalWrite(10,HIGH);
delay(2000);
Serial.println(F("Ready. Press f or r"));
}
void loop()
{
byte inChar;
randomSeed(analogRead(A0));
inChar = Serial.read();
if(inChar == 'f')
{randomSeed(analogRead(A0));
if(doFTP()) Serial.println(F("FTP OK"));
else Serial.println(F("FTP FAIL"));
}
if(inChar == 'r')
{
readSD();
}
}
File fh;
long rand=random(10000,999999);
Serial.printlt(rand);
the result is always 26807