Show Posts
Pages: [1] 2
1  Using Arduino / Microcontrollers / Re: Hex file from Arduino to at90usb1287 on: July 27, 2012, 11:49:52 am
So there wont be any problems with not having Arduino bootloader on the chip?

2  Using Arduino / Microcontrollers / Hex file from Arduino to at90usb1287 on: July 27, 2012, 05:53:41 am
Hei,

I was just wondering if i could just use Arduino IDE and libraries to compile the code and then take the .hex file and write it to my CPU using FLIP.

What would be problems when i would try to do this?

I found this http://www.instructables.com/id/Arduino-on-all-sorts-of-Atmels/#step1 when googeling and with the core files from http://www.avr-developers.com/ i should be able to use arduino as ISP. But thats not really what i want. I want to use Atmels bootloader what comes with the chips.

Best regards.
3  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Uno, WiFly and scrambled headers on: July 01, 2012, 04:42:06 am
Well, you are right again, but it seems that it wont matter where exactly the delay(); is (before or after), without it the code just wont run.

So PaulS you think this delay() might be the problem?
4  Using Arduino / Networking, Protocols, and Devices / Re: Arduino Uno, WiFly and scrambled headers on: June 30, 2012, 06:38:45 pm
Code:
 WiFlyClient client = server.available();
  delay(100);
  if (client) {
Of what possible value is the delay()?
Here's the topic about the delay in that spot: http://arduino.cc/forum/index.php/topic,111971.0.html

About the rest, yes the code needs some refactoring but im sure these things are not the issue in this case.. or i may be wrong smiley-grin
5  Using Arduino / Networking, Protocols, and Devices / Arduino Uno, WiFly and scrambled headers on: June 30, 2012, 04:45:59 pm
So im sending a GET request to my arduino server where i try to parse it to get the arguments. But what happens is that the heders get scrambeled, heres one example:
Code:
GET /&callback=jQuery1710012618871172890067_1341092772247?537.1zip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

Looks like there is part of it missing, but this is random, sometimes there is nothing missing but everything is just on one line..

Heres my arduino code: https://gist.github.com/3025646

So any ideas what should i do to fix this?
6  Using Arduino / Networking, Protocols, and Devices / Re: Anyone seeing this firmware crash on the WiFly RN-XV? on: June 28, 2012, 05:42:24 am
Tested this with firmware version 2.42 and this bug seems to be fixed.
7  Using Arduino / Networking, Protocols, and Devices / Re: WiFly hangs when using as server on: June 28, 2012, 05:13:20 am
Seems like this was just a timing issue. So if anybody having similar problems then adding
Code:
delay(200);
before
Code:
WiFlyClient client = server.available();
then everything should work just fine.
Heres the full working code:
Code:
/*
 * Web Server
 *
 * (Based on Ethernet's WebServer Example)
 *
 * A simple web server that shows the value of the analog input pins.
 */

#include <SPI.h>
#include <WiFly.h>

#include "Credentials.h"

WiFlyServer server(80);

void setup() {
  WiFly.begin();

  if (!WiFly.join(ssid, passphrase)) {
    while (1) {
      // Hang on failure.
    }
  }

  Serial.begin(9600);
  Serial.print("IP: ");
  Serial.println(WiFly.ip());
  
  server.begin();
}

void loop() {
  delay(200);
  WiFlyClient client = server.available();

  if (client) {
    Serial.println("We have a client!");
    // an http request ends with a blank line
    boolean current_line_is_blank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.print(c);
        // if we've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so we can send a reply
        if (c == '\n' && current_line_is_blank) {
          Serial.println("Request ended, send data back");
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          
          client.println("Hello World");
          
          client.stop();
          break;
        }
        if (c == '\n') {
          // we're starting a new line
          current_line_is_blank = true;
        } else if (c != '\r') {
          // we've gotten a character on the current line
          current_line_is_blank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(200);
    client.stop();
    Serial.println("Client stopped");
  }
}
8  Using Arduino / Networking, Protocols, and Devices / WiFly hangs when using as server on: June 27, 2012, 03:19:12 pm
Code:
/*
 * Web Server
 *
 * (Based on Ethernet's WebServer Example)
 *
 * A simple web server that shows the value of the analog input pins.
 */

#include <SPI.h>
#include <WiFly.h>

#include "Credentials.h"

WiFlyServer server(80);

void setup() {
  WiFly.begin();

  if (!WiFly.join(ssid, passphrase)) {
    while (1) {
      // Hang on failure.
    }
  }

  Serial.begin(9600);
  Serial.print("IP: ");
  Serial.println(WiFly.ip());
  
  server.begin();
}

void loop() {
  WiFlyClient client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean current_line_is_blank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        // if we've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so we can send a reply
        if (c == '\n' && current_line_is_blank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();

          client.print("Hello World!");

          break;
        }
        if (c == '\n') {
          // we're starting a new line
          current_line_is_blank = true;
        } else if (c != '\r') {
          // we've gotten a character on the current line
          current_line_is_blank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(100);
    client.stop();
  }
}

This is my simple hello world code im tryng to use with my WiFly. Wifly is associating with netowork and everyhting looks fine but when i make a request to WiFly ip then the green led on it stops flashing but the page on browser wont load. Sometimes when i press refresh the red led beside the green one flashes. Very rare occasions i manage to get the response from WiFly and its showed on browser.

Any ideas what should i check/do?

* Using Arduino UNO
* No other shields

EDIT:
When using SpiUartTerminal scetch then afther pointing my broser to Wifly i get this feedback:
Code:
*OPEN*GET / HTTP/1.1
Host: 192.168.69.3
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.11 Safari/537.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
And thats it, no response to the browser.. and if i try to send command through terminal it wont go through also.
9  Using Arduino / Project Guidance / Sending configuration to arduino on: April 06, 2012, 05:16:34 am
I'm looking for a idea how to resolve the process of sending configuration variables to arduino. Il be doing that over WiFly..
The ideas i'v had:
1) Send the values by one byte array and then parse it on the arduino: V1A2B4 .. etc where <tag><value> style
2) Send the values one by, receive and then send back the response that arduino successfully received the value and then send new another one. And again by using simple <tag><value>
3) Send command to arduino to enter config mode -> arduino starts sending request for config values and other end then parses the request and send back the value for that config parameter.

Any other ideas? What would be the best common approach?
10  Using Arduino / Networking, Protocols, and Devices / Re: Wifly shield not working with MicroSD shield on: March 28, 2012, 02:28:13 pm
Found a simple solution! The issue was in the 256MB micro SD card. Bough a new one today and everything works with the new card!
11  Using Arduino / Networking, Protocols, and Devices / Re: Wifly shield not working with MicroSD shield on: March 26, 2012, 11:21:05 am
I can try and redraw the circuit of microSD shield if that would help..?
12  Using Arduino / Storage / Re: Where to store array of doubles on: March 25, 2012, 08:32:19 am
There's no so much calculation there that the Arduino can't do it on-the-fly:
Code:
int LedDriverClass::getHue(byte temperature, byte startTemp, byte endTemp, int startHue, int endHue)
    {
    if (temperature < startTemp || temperature > endTemp)
        return 0;

    if (endHue <= startHue)
        endHue += 360;

    return map(temperature, startTemp, endTemp, startHue, endHue) % 360;
    }

The problem i see there is that i need to support changing hue both ways - up or down. Basically if i want the color to change from blue to red then the hue value must start decreasing when temperature is rising.
13  Using Arduino / Storage / Re: Where to store array of doubles on: March 24, 2012, 02:27:25 pm
Ok, but when using multimap then i would need 2 arrays - temperatures and hues:
Code:
int hues[] = {150,140,130,120,110,100, 90, 80, 70, 60, 50, 40, 30, 20};
int temps[]  = { 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33};
val = getTemp();
hue = multiMap(val, temps, hues, 14);

This way i would double the space used.

Here's the method how im mapping the values now:
Code:
void LedDriverClass::CalcHues(byte startTemp, byte endTemp, int startHue, int endHue)
{
double difference = (double)(startHue - endHue);
if (difference < 0)
difference = difference + 360;
double multiplier = difference/(endTemp - startTemp);

for(int i = tempStart; i<= tempEnd; ++i)
{
int hue = startHue - ((int) (i - startTemp)*multiplier);
if (hue < 0)
hue = hue + 360;
_colors[i] = hue;
}
}

Now when i call this method and give it for example startTemp 0 and endTemp 10, startHue 20 and endHue 0 then the result array would be:
_colors[] = {20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0, ...}
All the rest values in the array would be 0 (thats is also intentional). Now when i get temperature something like 5 i would just do _colors[5] and i will get the hue value what is 10 in this example.

But as i said before, i might be moving this calculation off the arduino and just upload/send the pre calculated values to arduino. And the question is where would be the best place to store these values?

(Since i havent got the microSD shield working with my Wifly shield (see topic: http://arduino.cc/forum/index.php/topic,98025.0.html)) then storing the values on SD card is out of options)
14  Using Arduino / Storage / Re: Where to store array of doubles on: March 24, 2012, 12:35:24 pm
120 doubles or floats take ~500 bytes, that can be in RAM if the rest of your application is not too RAM hungry.

If the changes are rare you could place the doubles in EEPROM, optionally an I2C EEPROM

Or store them in a file on an SD card
---
So far the storage alternatives, but there are more alternatives:

You said you calculate the doubles during setup(). that means that it is technically possible to calculate the floats if you need them. That probably means less RAM but extra time.

Another option might be finding the function that generates these 120 doubles given the inouts 0..120 (it is more difficult than you think but easier if you think)

And of course, why an array of doubles? Can the info not be stored in integers?

Finally there is interpolation, if the values can be interpolated you could use the map() or the multimap() functions.

In short:
Can you tell more about your doubles, how they are generated and how they are used?


Im not calculating the values when i need them because this gives me option to move the calculation off the arduino and just send the values to arduino.

Array itself is basically a lookup table. Its holding hue values and the position in array represent temperature. So if the current temperature is 37 then i get matching hue for that:
Code:
double hue = _colors[temp];
and then il use this hue to set rgb led color.

What i realise  now is that my HsvToRgb method doesn't care anyway if its a double it uses it as a int anyway.  So yes, i can hold them as int-s.

Im not familiar with interpolation (had to even look it up on google) so not sure i could use map() or the multimap() functions.
15  Using Arduino / Storage / Re: Where to store array of doubles on: March 24, 2012, 07:56:33 am
Heres the main consept how this will work:
I have couple of "input values" what are used to generate data what is stored hold in the array. There is no actual need to generate the array every time arduino starts, only when these "input values" are changed. So, no, the array will not be always the same but it will be the same most of the times since the "input values" are not changed so often.
Pages: [1] 2