Show Posts
Pages: 1 [2] 3 4 ... 12
16  Forum 2005-2010 (read only) / Syntax & Programs / Re: 3 PWM on: July 09, 2007, 03:47:49 pm
Why don't you put it all in 1 loop? You can control all 3 leds with 1 variable.
17  Forum 2005-2010 (read only) / Syntax & Programs / Re: flash memory and C on: June 28, 2007, 02:12:08 pm
I am using a 4Mbit dataflash chip, AT45DB041B,  from atmel. I should write some decent code and a tutorial about it. But at the moment all time is lost wrestling the arduino BT.  :-/

It works with SPI.
18  Forum 2005-2010 (read only) / Syntax & Programs / Re: flash memory and C on: June 28, 2007, 02:00:02 pm
Since 0008 there is an eeprom library.  Documentation is in the reference:
http://www.arduino.cc/en/Reference/EEPROM
19  Forum 2005-2010 (read only) / Syntax & Programs / ArduinoBT, "SET CONTROL BIND" troubles on: June 22, 2007, 02:43:21 pm
I am trying to program the pio's on the WT11. But whatever I try I always get a syntax error on the "SET CONTROL BIND" command. I tried it after the reset in the initialisation program and in the program from sondag: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1181825471/11#11
The line of code that doesn't work:
  
Code:
Serial.println("SET CONTROL BIND 0 4 FALL INFO");

I tried 04 instead of 4, CHANGE or RISE instead of FALL. I thought that it might the length of the string, but:
Code:
Serial.println("SET CONTROL BIND 0 4 ");

to switch off the bind is shorter then the SET CONTROL ESCAPE line and it still gives a syntax error. Is there some hidden feature to disable the BIND commands?
20  Forum 2005-2010 (read only) / Syntax & Programs / Re: writing to flash memory on: March 30, 2007, 01:09:13 pm
I don't know if I should use this. I can more or less follow what is happening. But, how do I know at what page to start? It won't be 0 I think?
This a little bit above my skills I am afraid.  :-[
21  Forum 2005-2010 (read only) / Syntax & Programs / Re: writing to flash memory on: March 30, 2007, 12:27:59 pm
Okay, no flash memory available it seems. I was hoping I could use the flash memory for slow data acquisition.
22  Forum 2005-2010 (read only) / Syntax & Programs / writing to flash memory on: March 30, 2007, 05:15:50 am
Can someone enlighten me about writing to flash memory? There is a link in the playground:
http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_rom_array
But with my limited C skills I can't really figure out what is going on.
Can I reserve a huge block of memory to store some data? Something like 3072 B to store 3 array's of bytes?
Can I read and write to it whenever I want?
Is there some restriction on speed?
23  Forum 2005-2010 (read only) / Syntax & Programs / Re: having trouble programming the solenoids on: January 18, 2007, 01:09:47 pm
You can send the numbers over the serial port. Reading and writing over the serial port is something you can find in the examples. But when you are in a delay() loop nothing else happens.
24  Forum 2005-2010 (read only) / Syntax & Programs / Re: having trouble programming the solenoids on: January 18, 2007, 10:37:57 am
While you are in a delay() loop you can't do anything else. You could put the switching of the solenoids in the loop() function. Measure time with millis(), when you are at the right time do something, switch solenoid on or off. Depending on what you want exactly you could use a switch/case statement. So, look up in the reference: millis and switch and see if it is of any use.
25  Forum 2005-2010 (read only) / Syntax & Programs / Re: how to make and use a class on: January 06, 2007, 04:36:16 pm
But is this .h necessary? If you start a new tab the file will be saved as a .pde file. So, I expected that a #include  "onewire.pde" would work, but it doesn't.


Okay, I tried it. If I rename the onewire.pde to onewire.h and I use "#include "onewire.h" it works. And it gets better, if I save the file als foo.h it won't get the pde extension. But this might be something platform specific? (I am on OSX)
So, only one question left: why does .h work and .pde not?
26  Forum 2005-2010 (read only) / Syntax & Programs / Re: how to make and use a class on: January 06, 2007, 03:21:54 pm
I didn't start the thread for a reusable library. It was more to get my code more readable. So I figured that a class in another tab would be helpful. After reading this http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1167857708 thread I figured it would be easy to do.  smiley

27  Forum 2005-2010 (read only) / Syntax & Programs / Re: how to make and use a class on: January 06, 2007, 02:53:19 pm
The mainfile testclass.pde:
Code:
// #include "onewire.pde"

OneWireLib  onewire;     // declare an instance of the OneWireLib class

void setup()
{
    int x = onewire.GetSomeVar();     // example of calling a class method
}
void loop()
{
}
and the class file onewire.pde:
Code:
class OneWireLib
{
public:
    OneWireLib()
    {
        int y =1;       // this 'y' will go away once the constructor returns (it is a local variable)
        somevar = 99;     // initialize class member variables here in the constructor
    }

    void ConvertTemp()
    {
         int x =1;
    }

    int GetSomeVar()    // example of method for using private data
    {
        return somevar;
    }

private:
      int somevar;      // put variables that are part of the object here
};        // <===  note semicolon here... terminates the class declaration
the onewire.pde file is in the same directory as the testclass.pde file.
And again, all this code in one file does work.
28  Forum 2005-2010 (read only) / Syntax & Programs / Re: how to make and use a class on: January 06, 2007, 12:59:48 pm
I tried you're example using a second tab and it doesn't work. This is the error:
error: 'OneWireLib' does not name a type In function 'void test()':


But, if I try it in one file it does work. What's the difference? I tried to #include the file but it is not found.
29  Forum 2005-2010 (read only) / Syntax & Programs / how to make and use a class on: January 05, 2007, 05:08:22 am
Is it possible to make a class in a .pde file? Something like this processing example? http://webzone.k3.mah.se/projects/arduino-workshop/projects/arduino_meets_processing/instructions/accelero.html
When I make a new tab in which I make a class arduino say's: "error: 'OneWireLib' does not name a type" Here is "OneWireLib" the name of the .pde file and the class.
For now the class is virtually empty:

Code:
class OneWireLib
{
OneWireLib()
{
  int y =1;
}
void ConvertTemp()
{
  int x =1;
}
}

In my main program I call the class like this:
Code:
OneWireLib owl;
30  Forum 2005-2010 (read only) / Interfacing / Re: ArduinoBt searching for other BT devices on: June 24, 2007, 03:41:14 am
I forgot, I change the serial buffer constantly. It is i wiring_analog.c. But the serial  buffer is in RAM if I am not mistaken, so increasing the buffer decreases space for your variables. Since you only have 1k there is a limit to what you can do.

Try changing it. At some point I also printed out the returned size of the string. If that equals the serial buffer you know that you are missing info. I also increased the textstring size. Eventually I tried the eeprom.
Pages: 1 [2] 3 4 ... 12