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.
|
|
|
|
|
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: 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, ¤t); 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, ¤t); } return received; }
|
|
|
|
|
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,  ; // 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!
|
|
|
|
|
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... 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() { }
|
|
|
|
|