Show Posts
Pages: [1] 2 3 ... 17
1  Using Arduino / Programming Questions / Re: Bit Angle Modulation problem on: July 22, 2013, 01:05:48 am
When you say doesn't work, do you mean it doesn't compile or doesn't do what you expect?
2  Using Arduino / Programming Questions / Re: Arduino webserver --Internet Explorer, no download from download link on: July 19, 2013, 02:42:46 pm
You want your response section to be something like: (I've removed some of the unnecessary logic)
Code:
webFile = SD.open("log.txt");
if (webFile) {
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: application/octet-stream");
client.println("Content-Disposition: attachment");
client.print("Content-Length: ");
client.println(webFile.available());
client.println();
while(webFile.available()) {
client.write(webFile.read()); // send web page to client
}
webFile.close();
}
This isn't tested but should work, I've added the content length as well, as it helps the browser to know this.
3  Using Arduino / Programming Questions / Re: Arduino webserver --Internet Explorer, no download from download link on: July 18, 2013, 04:56:16 pm
When you get the request for the text file you need to set
Code:
Content-Type: application/octet-stream
in the HTTP response headers.
Post your code for additional help  smiley-wink
4  Using Arduino / Networking, Protocols, and Devices / Re: power saving mode on: May 22, 2013, 01:29:06 am
The Arduino does have a sleep mode, but that won't put your transmitter to sleep, unless it has a sleep mode as well. You could try using a transistor on the power/ground line of the transmitter to switch it on and off when you need to.
5  Using Arduino / Programming Questions / Re: Newbie here!! Starting a loop while its still finishing? on: May 20, 2013, 02:52:52 am
That would be a very easy change to make:
Code:
void loop(){

   int val=analogRead(A0);
   Period_over_6=map(val,0,1023,MIN_PERIOD,MAX_PERIOD);

   setPins_P(HIGH,LOW,HIGH);
   setPins_N(LOW,HIGH,LOW);
   delay(Period_over_6);
   setPins_P(HIGH,LOW,LOW);
   setPins_N(LOW,HIGH,HIGH);
   delay(Period_over_6);
   setPins_P(HIGH,HIGH,LOW);
   setPins_N(LOW,LOW,HIGH);
   delay(Period_over_6);
   setPins_P(LOW,HIGH,LOW);
   setPins_N(HIGH,LOW,HIGH);
   delay(Period_over_6);
   setPins_P(LOW,HIGH,HIGH);
   setPins_N(HIGH,LOW,LOW);
   delay(Period_over_6);
   setPins_P(LOW,LOW,HIGH);
   setPins_N(HIGH,HIGH,LOW);
   delay(Period_over_6);
}
6  Using Arduino / Programming Questions / Re: Trying to combine twitter with another program. Also prevent duplicates. on: May 18, 2013, 02:54:19 am
Startby removing the delay from your twitter code, then put each one into a function, e.g checkTwitter() and checkWiFi(). In your main loop you will want to call chekWiFi() every time and checkTwitter() every minute. So something like:
Code:
unsigned long nextTwitterCheck;

void loop(){
   checkWiFi();
   if(millis()>nextTwitterCheck){
      checkTwitter();
      nextTwitterCheck+=60000;
   }
}
7  Using Arduino / Programming Questions / Re: TEA encryption algorithm test vector on: May 17, 2013, 08:15:11 pm
Code:
char Str6[15] = {"Welcome","to","Arduino","World"};
Looks like odd syntax to me, char Str6[15] allocates an array of char with 15 elements, {"Welcome","to","Arduino","World"} is an array of pointers to chars, i.e. a char**, so these types don't match.
The way you should do it is create a single char array, with the length being a factor of 8:
Code:
char Str6[32]="Welcome to Arduino World";
Even though "Welcome to Arduino World" is only 20 something characters long it allocates 32 bytes, to ensure 64 bit blocks, and the remaining bytes are all padded with 0s
8  Using Arduino / Programming Questions / Re: TEA encryption algorithm test vector on: May 17, 2013, 08:06:40 pm
It's impossible to tell what the problem could be as there are too many unknowns. Break your code up so that you can treat each bit individually. Start by making a program that sends plain characters with the RF module and ensure that you can reconstruct it at the other end correctly. Then put this into a function that takes an arbitrary array of bytes, again test with simple data to ensure it works. When you have that function created and working, your encryption and sending become independent of each other, for example if the output is incorrect then it must be the encryption, you will know where to look.
9  Using Arduino / Programming Questions / Re: Help me make sense of these bits on: May 17, 2013, 05:33:12 am
It looks as though the second byte is some sort of sequence number, if you discard the highest 4 bits (all 1111) and reverse the order of the lower 4 bits you get:
1010
1001
1000
0111
etc.
which is just decrementing. When it gets to 0000 it underflows (is that a word?) and goes back to 1111
10  Using Arduino / Programming Questions / Re: Web server, How to make a simple button to reset a counter?? on: May 16, 2013, 02:14:02 am
At the moment you are skipping over the request from the client, you will need to parse this request to check for the button press and rest the counter accordingly.
11  Using Arduino / Programming Questions / Re: Problem with files on: May 16, 2013, 01:55:35 am
It looks like there may be some problems with that library. You could try going through and fixing some of those function calls.
12  Using Arduino / Programming Questions / Re: Newbie here!! Starting a loop while its still finishing? on: May 16, 2013, 01:40:40 am
Those if statements are wrong. if (count =1) will always be true, = assigns the value of count and then returns the result of the assignment, it should be a ==, i.e. if (count==1), which is a comparison. Also you shouldn't have semi-colons at the end of your if() line, that terminates the if statement there.
There also must be a Much cleaner way to write this?
There is smiley the way I suggested:
Code:
void loop(){
   setPins(HIGH,LOW,HIGH);
   delay(Period_over_6);
   setPins(HIGH,LOW,LOW);
   delay(Period_over_6);
   setPins(HIGH,HIGH,LOW);
   delay(Period_over_6);
   setPins(LOW,HIGH,LOW);
   delay(Period_over_6);
   setPins(LOW,HIGH,HIGH);
   delay(Period_over_6);
   setPins(LOW,LOW,HIGH);
   delay(Period_over_6);
}

void setPins(char pin1,char pin2,char pin3){
   digitalWrite(Phase1Pin_P,pin1);
   digitalWrite(Phase2Pin_P,pin2);
   digitalWrite(Phase3Pin_P,pin3);
}
13  Using Arduino / Programming Questions / Re: XML string on: May 15, 2013, 05:34:05 pm
Your request should probably be:
Code:
err=http.post("ds.sidnow.com", 80, url);
ds.sidnow.com/ is not a valid host name so may be the problem.
Can't be sure though as I don't know what library you're using! smiley
Also next time please put all your code in code tags: [code][/code]
14  Using Arduino / Programming Questions / Re: TEA encryption algorithm test vector on: May 15, 2013, 05:27:06 pm
Have you got it working just sending basic strings? If you've got two bytes, you can get the lower four bits by and-ing with 0x0F and the higher 4 bits by and-ing with 0xF0 then right shifting by 4.
15  Using Arduino / Programming Questions / Re: Newbie here!! Starting a loop while its still finishing? on: May 15, 2013, 03:19:41 pm
It should be possible to do it completely with that technique, split your period into 6, then do it as:
1 ON, 2 OFF, 3 ON
1 ON, 2 OFF, 3 OFF
1 ON, 2 ON , 3 OFF
1 OFF, 2 ON, 3 OFF
1 OFF, 2 ON, 3 ON
1 OFF, 2 OFF, 3 ON

If you set the outputs on each part it will always stay in phase perfectly
Pages: [1] 2 3 ... 17