Show Posts
Pages: [1] 2
1  Development / Other Software Development / Re: Arduino Programmed from eclipse does nothing on: July 19, 2011, 07:52:32 am
I think I can. I'm doing some testing at this point, if that doesn't work out I will sent you the project.
2  Development / Other Software Development / Re: Arduino Programmed from eclipse does nothing on: July 19, 2011, 07:32:50 am
Hey Maruis,

Thanks for your reply. Sorry for my late reaction, I was away for a short holiday. Your settings work well with a c project. The thing is that I need (actually, want) object oriƫntation. The weird thing is that compiling gives no errors and even uploading goes well, but then, nothing...
3  Development / Other Software Development / Arduino Programmed from eclipse does nothing on: July 06, 2011, 09:16:35 am
Hey All,

Hope this is the right forum, but here goes. I've used the description on http://www.arduino.cc/playground/Code/Eclipse to get everything up and running in Eclipse. To be complete, I run Ubuntu 11.04 with Eclipse 3.6.2
Now here's the weird part. When I create a main.cpp file the way suggested, i get no compile errors whatsoever. Uploading to the arduino all goes well, but then comes the weirdness. Without changes to the code, different uploads give different results. Here's what is supposed to happen:
led 13 should blink on and off (every 750 ms) an every second "loop" should be written on Serial. Whta happens is that after upload sometimes pin 13 blinks, but then superfast and Serial does nothing. Most of the time however nothing happen and every pin exept the ground pin is set to HIGH (or atleast, whenever I connect a led it lights up). When I copy the setup and loop functions to an arduino sketch everything works.
Heres main.cpp:

Code:
#include <stdlib.h>
#include <WProgram.h>

unsigned long currentTime = 0;
unsigned long sendTime = 0;

void setup()
{
Serial.begin(4800);
pinMode(13, OUTPUT);
}

void loop()
{
currentTime = millis();
digitalWrite(13, (currentTime % 1500 <750) ? LOW : HIGH);
if(currentTime - sendTime > 1000)
{
sendTime = currentTime;
Serial.println("loop");
}
}

extern "C" void __cxa_pure_virtual()
{
  cli();
  for (;;);
}

__extension__ typedef int __guard __attribute__((mode (__DI__)));

void * operator new(size_t size)
{
  return malloc(size);
}

void operator delete(void * ptr)
{
  free(ptr);
}

void * operator new[](size_t size)
{
    return malloc(size);
}

void operator delete[](void * ptr)
{
if (ptr)
free(ptr);
}

int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);}
void __cxa_guard_release (__guard *g) {*(char *)g = 1;}
void __cxa_guard_abort (__guard *) {}

int main(void)
{
init();
setup();
for(;;)
{
loop();
}
return 0;
}

4  Forum 2005-2010 (read only) / Syntax & Programs / Re: function not declared in scope on: December 16, 2009, 05:44:50 am
ok, good to know.
5  Forum 2005-2010 (read only) / Syntax & Programs / Re: function not declared in scope on: December 16, 2009, 05:13:03 am
This seems to work indeed. Why isn't arduino creating prototypes for references?
6  Forum 2005-2010 (read only) / Syntax & Programs / Re: function not declared in scope on: December 16, 2009, 05:00:55 am
@mem: I need the reference because I want to have a general function to set global variables.
7  Forum 2005-2010 (read only) / Syntax & Programs / Re: function not declared in scope on: December 16, 2009, 04:59:35 am
It seems to go wrong with the references. When I remove them (which I don't want), compiling works.
8  Forum 2005-2010 (read only) / Syntax & Programs / Re: function not declared in scope on: December 16, 2009, 04:53:08 am
Ok, I've broke it even more down and still getting the error. Here's the code as it is now:
Code:
int redInterval   = 0;
long redStartTime   = 0;

void setup()
{
  Serial.begin(9600);
  setColorInterval(redStartTime, redInterval);
}

void loop()
{
}

void setColorInterval(long &startTime, int &interval)
{
}
9  Forum 2005-2010 (read only) / Syntax & Programs / Re: function not declared in scope on: December 16, 2009, 04:16:18 am
I thought of that as well, but when i remove the second function (it can be done without of course) the problem remaines.
10  Forum 2005-2010 (read only) / Syntax & Programs / Re: function not declared in scope on: December 15, 2009, 12:16:22 pm
cpp file:
Code:
// CONSTANTS
#include "WProgram.h"
void setup();
void loop();

const char STATE_DEFAULT  = 'A';

// ENVIRONMENT VARIABLES
long currentTime = 0;
char state = STATE_DEFAULT;
int redInterval   = 0;
int blueInterval  = 0;
int greenInterval = 0;
long redStartTime   = 0;
long blueStartTime  = 0;
long greenStartTime = 0;

void setup()
{
  Serial.begin(9600);
  setColorInterval(redStartTime, redInterval);
  setColorInterval(blueStartTime, blueInterval);
  ssetColorInterval(greenStartTime, greenInterval);
}

void loop()
{
}

void setColorInterval(long &startTime, int &interval, int minInterval, int maxInterval)
{
  if((startTime == 0) || (currentTime - startTime >= interval))
  {
    interval = random(minInterval, maxInterval);
    startTime = currentTime;
  }
}

void setColorInterval(long &startTime, int &interval)
{
  setColorInterval(startTime, interval, 0, 10000);
}

int main(void)
{
      init();

      setup();
    
      for (;;)
            loop();
        
      return 0;
}



It seems that something goes wrong since no prototype is created for the functions
11  Forum 2005-2010 (read only) / Syntax & Programs / Re: function not declared in scope on: December 15, 2009, 12:02:36 pm
This works indead, but it should work without. I have written programs in arduino before in the same way and it worked perfect. This is because the arduino build environment automatically creates prototypes for functions in the main tab of a sketch so there is no need to put a function declaration before it is called. So my question remaines.
12  Forum 2005-2010 (read only) / Syntax & Programs / function not declared in scope on: December 15, 2009, 11:42:05 am
This is the program (not finished as you can see):
Code:
// CONSTANTS
const char STATE_DEFAULT  = 'A';

// ENVIRONMENT VARIABLES
long currentTime = 0;
char state = STATE_DEFAULT;
int redInterval   = 0;
int blueInterval  = 0;
int greenInterval = 0;
long redStartTime   = 0;
long blueStartTime  = 0;
long greenStartTime = 0;

void setup()
{
  Serial.begin(9600);
  setColorInterval(redStartTime, redInterval);
  setColorInterval(blueStartTime, blueInterval);
  ssetColorInterval(greenStartTime, greenInterval);
}

void loop()
{
}

void setColorInterval(long &startTime, int &interval, int minInterval, int maxInterval)
{
  if((startTime == 0) || (currentTime - startTime >= interval))
  {
    interval = random(minInterval, maxInterval);
    startTime = currentTime;
  }
}

void setColorInterval(long &startTime, int &interval)
{
  setColorInterval(startTime, interval, 0, 10000);
}

When I compile this code I get a "In function 'void setup()': error: 'setColorInterval' was not declared in this scope".
Even when I move the function call from setup to loop() it still gives me the error for loop. Why am I getting this error?
13  Forum 2005-2010 (read only) / Troubleshooting / Re: arduino library with eclipse on: December 01, 2009, 06:30:11 am
I am struggling with this as well. I have HardwareSerial.h included but is doesn't make any difference. Does anybody have this fixed yet?
14  Forum 2005-2010 (read only) / Interfacing / Re: Interfacing Dynamixel AX-12 servo? on: November 03, 2009, 05:35:41 am
This topic is old, but I'm trying to get this thing working as well, not with succes for now... Anybody got this working?
15  Forum 2005-2010 (read only) / Interfacing / Re: multiple serial communications and rgb leds on: December 18, 2009, 03:57:23 am
It has been a while since I posted my question and we looked through all the offered solutions. In the end we chose to do it differently. We are using the serial connection of the arduino. The Tx goes to all four nodes in parallel and the Rx is multiplexed. This actually works very well. We are setting up some prototypes with custom made pcb's for the connection rings. If they are done I'll make some pictures and post a link to the blog with an extensive explanation on how it works.
Thanks for all the help!
Pages: [1] 2