Show Posts
Pages: [1] 2 3 ... 6
1  Using Arduino / Programming Questions / Library name problem on: May 24, 2011, 08:02:08 am
I already have 2 libraries, compatible with arduino in source code, but their names are like this:

atmega-timers
atmega-scheduler

Arduino gave me an error saying that libraries can't contain signs and such. Why exists such a  limitation? I'm not using spaces or numbers.
2  Using Arduino / Microcontrollers / Re: Atmega for uno with more memory ram on: May 11, 2011, 01:00:33 pm
As others said, try http://sanguino.cc/

It's what I use and it works great

I'm using it even without arduino software
3  Community / Exhibition / Gallery / Timer library on: May 11, 2011, 09:44:28 am
Hi, i'm sharing with you my last library for controlling timer interrupts. It's really easy to use.

It's called atmega-timers and code and information is hosted at github:
https://github.com/jvalencia80/atmega-timers

Give it a try on arduino and let me know how is it working for you smiley
4  Forum 2005-2010 (read only) / Troubleshooting / Re: my experience trying to install arduino on Ubu on: May 22, 2008, 03:08:06 pm
it works very easy on ubuntu 8.04, no need to compile anything.
5  Forum 2005-2010 (read only) / Troubleshooting / Re: PC <-> Arduino serial problems on: May 23, 2008, 10:21:01 am
ahhh thanks for the tips, finally i did it.
here is the working function:

Code:
int fdread(int fd, void *buffer, int size, int timeout) {  // timeout in milliseconds
  char *ptr = (char*)buffer;
  int received = 0;
  long int tout;
  struct timespec current;

  clock_gettime(CLOCK_REALTIME, &current);
  tout = current.tv_nsec + (timeout*1000000);
      
  while((received < size) && (tout > current.tv_nsec)) {
    if (read(fd, ptr, 1) == 1) {
      ptr++;
      received++;
    }
    clock_gettime(CLOCK_REALTIME, &current);
  }
  return received;
}
6  Forum 2005-2010 (read only) / Troubleshooting / Re: PC <-> Arduino serial problems on: May 23, 2008, 09:05:26 am
mmm i'll try that, thanks for the tip.  :smiley
7  Forum 2005-2010 (read only) / Troubleshooting / Re: PC <-> Arduino serial problems on: May 23, 2008, 04:49:34 am
i tried using a loop with select calls, and i got always 1-2 timeouts. After that, i got good results.
also, the sleep(1) is incredible, since it removes the error always.
8  Forum 2005-2010 (read only) / Troubleshooting / Re: PC <-> Arduino serial problems on: May 22, 2008, 05:37:53 pm
but that is not my problem, since i can wait a minute before sending data, and it generates the same error.
my problem is that when i do a write, and then a read, i will get random data. If i put a sleep(1) between write and read, i get a good result.
9  Forum 2005-2010 (read only) / Troubleshooting / Re: PC <-> Arduino serial problems on: May 22, 2008, 05:10:54 pm
mmm can you explain it with more detail?
10  Forum 2005-2010 (read only) / Troubleshooting / PC <-> Arduino serial problems on: May 22, 2008, 12:40:30 pm
I'm having serious issues when interfacion arduino with C code on my linux box.

the code on the linux box is like this:

a loop
  write(fd, "get", 3); // tell arduino to send data
  read(fd, &buffer, smiley-cool; // read 8 bytes;
end of loop

the first time i read, it returns crap.
the second time too.
the third time starts working.

I can solve it with a sleep(1) before reading, but it's not desired.
I've coded too, a loop with a select call for polling the file descriptor for incoming data, and i get a timeout for the first and second time.

I really don't know whats happening, i need help!
11  Forum 2005-2010 (read only) / Troubleshooting / Re: undefined references and static keyword on: May 20, 2008, 08:37:19 am
Follower, sorry, i didn't see your post. Your correct, it's a missing feature of avr-g++.

wayoda: yes, i know some people think c++ is ugly itself. I'm a ruby-boy but i've used C and C++ for years too, and i've seen that programmer wars are too common. Thanks for your support!
12  Forum 2005-2010 (read only) / Troubleshooting / Re: undefined references and static keyword on: May 20, 2008, 06:48:12 am
interesting, the solution is a bit "ugly" since i need more classes to do a simple thing, but i'll stick with an object outside of the method.

thanks for solving this issue smiley
13  Forum 2005-2010 (read only) / Troubleshooting / Re: undefined references and static keyword on: May 19, 2008, 12:04:40 pm
I don't want singleton, since it allows only 1 instance for each class.
I can declare many alarms, for example: Alarm x,y,z;

In my code i declare an Alarm as static instead of global, because it will be used only on that function and i want it to be persistent. But it looks like not working at all.
14  Forum 2005-2010 (read only) / Troubleshooting / Re: undefined references and static keyword on: May 19, 2008, 08:57:12 am
well, i wanted it to be inside the function, but looks like a compiler related error, isn't it?
i can use it outside, no problem, but it's an interesting bug.
15  Forum 2005-2010 (read only) / Troubleshooting / Re: undefined references and static keyword on: May 19, 2008, 08:25:26 am
mem can you try this simple code? it repeats the compile error...

Code:
class Alarm {
      private:
            unsigned long time;
            
      public:
            Alarm();
            Alarm(unsigned long t);
            ~Alarm();
            void set(unsigned long t);
            void unset();
            boolean checked();
};

Alarm::Alarm() {
      time = 0;
}

Alarm::Alarm(unsigned long t) {
      time = millis() + t;
}

Alarm::~Alarm() {
      time = 0;
}

void Alarm::set(unsigned long t) {
      time = millis() + t;
}

void Alarm::unset() {
      time = 0;
}

boolean Alarm::checked() {
      if ((!time) || (time > millis()))
            return false;
      else
            return true;
}

void example() {
  static Alarm x;
}

void setup() {
}

void loop() {
}
Pages: [1] 2 3 ... 6