Loading...
  Show Posts
Pages: 1 ... 464 465 [466] 467 468 ... 629
6976  Using Arduino / Programming Questions / Re: multi-array on: May 29, 2011, 05:18:08 pm
Does the content of the array change often? If not you might consider using an I2C EEPROM to store it ?
6977  Using Arduino / Storage / Re: EEPROM_writeAnything - slightly improved on: May 29, 2011, 05:16:01 pm

Maybe it is better to change it one level lower in the EEPROM class in EEPROM.cpp, Then other EEPROM applications would benefit from it too!

from EEPROM.cpp
Code:
uint8_t EEPROMClass::read(int address)
{
return eeprom_read_byte((unsigned char *) address);
}

void EEPROMClass::write(int address, uint8_t value)
{
eeprom_write_byte((unsigned char *) address, value);
}

to

Code:
uint8_t EEPROMClass::read(int address)
{
return eeprom_read_byte((unsigned char *) address);
}

void EEPROMClass::write(int address, uint8_t value)
{
         if (eeprom_read_byte((unsigned char *) address) != value) eeprom_write_byte((unsigned char *) address, value);
}
6978  Using Arduino / Storage / Re: EEPROM_writeAnything - slightly improved on: May 29, 2011, 04:55:24 pm
Besides a memory test, do you have some figures about the speed differences?  

I think of a testcase with a 20 bytes struct or array ... ( don't have an Arduino free at the moment smiley-sad

# same, # time without read, time with read
0, t1, t2
1,
...
20,

TIA,
Rob

The theoretical value : http://www.arduino.cc/en/Reference/EEPROMWrite => An EEPROM write takes 3.3 ms to complete
Can't find the value for EEPROMRead() ??

---

the char c is not needed?

Code:
template <class T> int EEPROM_writeAnything(int ee, const T& value)
{
  const byte* p = (const byte*)(const void*)&value;
  int i;
  for (i = 0; i < sizeof(value); i++) {
    if (EEPROM.read(ee) != *p) EEPROM.write(ee, *p);
    }
    *p++;
    ee++;
  }
  return i;
}
6979  Using Arduino / Networking, Protocols, and Devices / Re: Troubleshooting - Better way? on: May 29, 2011, 04:46:29 pm
View one Arduino with the IDE serial monitor and the other with a terminal program like putty.exe

Furthermore, read this one? - http://www.arduino.cc/en/Tutorial/MasterReader - ?
6980  Using Arduino / Project Guidance / Re: Text Messaging Dog Water Bowl on: May 29, 2011, 04:38:16 pm

First of all , very nice project!

I often advise people to spent time on the reference and tutorial sites of Arduin.cc as there is so much information there how to program things.

What should the water sensor measure?  an ON/OFF condition ? There is water / there is no water?
of There is xyz milliliter of water?  a more analog condition.

The fun of the latter is of course on can make nice graphs in Excel how the water evaporates, what happens when the dog drinks and when it is refilled.

Check - http://www.sparkfun.com/products/9072 -

Furthermore I advise to order a good watertight casing for the Arduino...

sofar my 2 cents,


6981  Using Arduino / Project Guidance / Re: Ammeter project on: May 29, 2011, 04:25:15 pm
THink the title should say "mA meter" ?

As I'm no electrical engineer I don't know it it will work, I would say the GND from the right must be connected somewhere to the left and that said, Is this not one of the things you use opamps for?

Rob
6982  Using Arduino / General Electronics / Re: Killed my adxl321 accelerometer? on: May 29, 2011, 04:15:20 pm
@liudr
Are your students going to built a system from the same description as you did? Triple check those instructions!






6983  Using Arduino / Programming Questions / Re: Send struct using Ethernet library on: May 29, 2011, 03:23:29 pm

For the Arduino side it is not really complex, something like this

Code:
simple_send(uint8_t *p, uint8_t size)
{
  for(uint8_t i=0; i< size; i++) client.write(*p++);
}

send_struct_numbers(struct numbers_t *num)
{
  simple_send(&num.first, 1)
  simple_send(&num.second, 2);
  simple_send(&num.third, 4);
}

void loop()
{
  ...
  send_struct_numbers(&numbers);
  ...
}
6984  Using Arduino / Displays / Re: Interface with a computer graphic card on: May 29, 2011, 10:27:57 am
Quote
Do you know where we can buy it?

no, but there was an email address on the page

Quote
If you have questions, email me at jamesb@excamera.com
6985  Using Arduino / Programming Questions / Re: Send struct using Ethernet library on: May 29, 2011, 10:24:55 am
Thanx Ramo102,

So the lesson learned is that sending structs is not straightforward due to different memory alignment at the sending and receiving side.
Your solution is to force memory alignment to be identical, is a good option as it works.

Another option would be explicit serialization and deserialization at both side. That means mapping the structmembers one by one on a bytestream and on the receiving side map the bytestream on the members. The advantage of serialization is portability for the price of some extra code.


6986  Using Arduino / Displays / Re: Interface with a computer graphic card on: May 29, 2011, 09:25:54 am
Sorry,  I replied too fast.

Can you describe what kind of graphics you want to make? Resolution etc?

Have you seen this one - http://excamera.com/sphinx/gameduino/index.html?highlight=vga

Found it through - http://shieldlist.org/
6987  Using Arduino / Programming Questions / Re: Sending Full Words from Serial Monitor on: May 29, 2011, 09:15:56 am
You need to define a command packet, and a piece of code that reads a complete packet. How do you know its complete? The trick is to add a separator that is no part of the command. Example

true,255#
false,113#
Note that the , functions as separator

You need something like this readCommand() [not tested] to read one complete command; then you can split command into fields ( search for strtok() example )

Code:
int readCommand()
{
  char lastchar = ''';
  int i= 0;
  while (lastchar != '#')
  {
    if (Serial.available()>0)
    {
      lastchar = Serial.Read();
      if (lastchar == #)
      {
         command[i] = '\0';
      } else command[i++] = lastchar;
    }
  }
}

Hopes this helpes
6988  Using Arduino / Programming Questions / Re: multi-array on: May 29, 2011, 09:06:02 am
Quote
How do I do that? I do not know how many pointers I need..
malloc() and free() are the magic commands - http://www.cplusplus.com/reference/clibrary/cstdlib/free/
6989  Using Arduino / Programming Questions / Re: multi-array on: May 29, 2011, 07:36:57 am

Furthermore there is one dimension with size 1

 #define cnt_programs 1   

so it will allways have the same value, does this change in the future? If not you better remove that dimension.
6990  Using Arduino / Displays / Re: Interface with a computer graphic card on: May 29, 2011, 04:22:12 am
In the upper right is the search box, if you type in VGA you will get several threads regarding VGA.

Furthermore you can search the playground and you will find - http://www.arduino.cc/playground/Main/MicroVGA - which looks quite good imho

Rob
Pages: 1 ... 464 465 [466] 467 468 ... 629