Show Posts
Pages: [1]
1  Using Arduino / Installation & Troubleshooting / Arduino Ethernet Shield with Ardino Ethernet ? on: January 30, 2013, 02:07:13 pm
Is it possible to use an arduino ethernet shield with an arduino ethernet somehow? a friend of mine needs control over 2 ethernet connections. Can he solder the connections somehow?
2  Using Arduino / Programming Questions / Re: variable or field 'name' declared void on: January 13, 2013, 01:42:41 am
works, you're the man smiley


thank you very much !
3  Using Arduino / Programming Questions / Re: variable or field 'name' declared void on: January 13, 2013, 01:12:32 am
had a typo in the function name, but makes no difference
4  Using Arduino / Programming Questions / Re: variable or field 'name' declared void on: January 13, 2013, 12:41:12 am
RedFly is the library for the watterord wifly shield

https://github.com/watterott/RedFly-Shield

here is the link to the library and test examples https://github.com/watterott/RedFly-Shield/downloads

i had rename the ardosc because i have an other version in my library, but even if i use the original renamed version there is no difference.

i had the wifly shield running so the library seems to work fine, i think it's more a general problem
5  Using Arduino / Programming Questions / Re: variable or field 'name' declared void on: January 13, 2013, 12:13:58 am
none  smiley-confuse these are the only ones, just black space
6  Using Arduino / Programming Questions / variable or field 'name' declared void on: January 13, 2013, 12:07:41 am
Hi folks, a have a nasty problem, i can't get this solved i constantly get an the message that my function funcOnOf is declared void. I tried to include some code that receives osc messages i got working with an arduino ethernet on an anarduino uno with a redfly shield where i could get a connection with the wifi router an send the output of a pololu MinIMU-9 v.2.


i think it has something to do with the callback function    server.addCallback("/Eth_ArdOSC/toggle2", &funcOnOff); in initialize (). I also read that the arduino ide has some hidden problems in certain situations with pointers... dunno

MinIMU9AHRS:46: error: variable or field 'funcOnOf' declared void
MinIMU9AHRS:46: error: 'OSCMessage' was not declared in this scope
MinIMU9AHRS:46: error: '_mes' was not declared in this scope
MinIMU9AHRS:131: error: redefinition of 'OSCServer server'
MinIMU9AHRS:112: error: 'OSCServer server' previously declared here
MinIMU9AHRS.ino: In function 'void initialize()':
MinIMU9AHRS:290: error: 'funcOnOff' was not declared in this scope

some weird thing is i get this error in line 46 where usally is some commented text of the pololu example....

Code:

// Uncomment the below line to use this axis definition:
   // X axis pointing forward
   // Y axis pointing to the right
   // and Z axis pointing down.
// Positive pitch : nose up
// Positive roll : right wing down
// Positive yaw : clockwise
int SENSOR_SIGN[9] = {1,1,1,-1,-1,-1,1,1,1}; //Correct directions x,y,z - gyro, accelerometer, magnetometer
// Uncomment the below line to use this axis definition:
   // X axis pointing forward
   // Y axis pointing to the left
   // and Z axis pointing up.
// Positive pitch : nose down
// Positive roll : right wing down
// Positive yaw : counterclockwise

// tested with Arduino Uno with ATmega328 and Arduino Duemilanove with ATMega168

#include <Wire.h>

#include <RedFly.h> //wifi shield watterod
#include <ArdOSCW.h> //ArdOSC Library had to rename

//defines 1mbit
#define WIFISPEED 115200
#define WIFIPOWER LOW_POWER_1M   //LOW_POWER_1M oder MED_POWER_1M
 

// LSM303 accelerometer: 8 g sensitivity
// 3.8 mg/digit; 1 g = 256
#define GRAVITY 256  //this equivalent to 1G in the raw data coming from the accelerometer

#define ToRad(x) ((x)*0.01745329252)  // *pi/180
#define ToDeg(x) ((x)*57.2957795131)  // *180/pi

// L3G4200D gyro: 2000 dps full scale
// 70 mdps/digit; 1 dps = 0.07
#define Gyro_Gain_X 0.07 //X axis Gyro gain
#define Gyro_Gain_Y 0.07 //Y axis Gyro gain
#define Gyro_Gain_Z 0.07 //Z axis Gyro gain
#define Gyro_Scaled_X(x) ((x)*ToRad(Gyro_Gain_X)) //Return the scaled ADC raw data of the gyro in radians for second
#define Gyro_Scaled_Y(x) ((x)*ToRad(Gyro_Gain_Y)) //Return the scaled ADC raw data of the gyro in radians for second
#define Gyro_Scaled_Z(x) ((x)*ToRad(Gyro_Gain_Z)) //Return the scaled ADC raw data of the gyro in radians for second

// LSM303 magnetometer calibration constants; use the Calibrate example from
// the Pololu LSM303 library to find the right values for your board
#define M_X_MIN -421
#define M_Y_MIN -639
#define M_Z_MIN -238
#define M_X_MAX 424
#define M_Y_MAX 295
#define M_Z_MAX 472

#define Kp_ROLLPITCH 0.02
#define Ki_ROLLPITCH 0.00002
#define Kp_YAW 1.2
#define Ki_YAW 0.00002

/*For debugging purposes*/
//OUTPUTMODE=1 will print the corrected data,
//OUTPUTMODE=0 will print uncorrected data of the gyros (with drift)
#define OUTPUTMODE 1

//#define PRINT_DCM 0     //Will print the whole direction cosine matrix
//#define PRINT_ANALOGS 0 //Will print the analog raw data
#define PRINT_EULER 1   //Will print the Euler angles Roll, Pitch and Yaw

#define STATUS_LED 13
//
//osc send

byte myIp[] = { 192, 168, 178, 130 };
uint16_t serverPort = 10000;
uint16_t destPort = 12000;
byte destIp[] = { 192, 168, 178, 76 };

OSCServer server;
OSCClient client;
  
//osc variables
float oscRoll;
float oscPitch;
float oscYaw;

int t = 100;

//visual rgb led
int ledGreen=6;
int ledBlue=5;
int ledRed=3;
int val;

//tracker

float G_Dt=0.02;    // Integration time (DCM algorithm)  We will run the integration loop at 50Hz if possible

long timer=0;   //general purpuse timer
long timer_old;
long timer24=0; //Second timer used to print values
int AN[6]; //array that stores the gyro and accelerometer data
int AN_OFFSET[6]={0,0,0,0,0,0}; //Array that stores the Offset of the sensors

int gyro_x;
int gyro_y;
int gyro_z;
int accel_x;
int accel_y;
int accel_z;
int magnetom_x;
int magnetom_y;
int magnetom_z;
float c_magnetom_x;
float c_magnetom_y;
float c_magnetom_z;
float MAG_Heading;

float Accel_Vector[3]= {0,0,0}; //Store the acceleration in a vector
float Gyro_Vector[3]= {0,0,0};//Store the gyros turn rate in a vector
float Omega_Vector[3]= {0,0,0}; //Corrected Gyro_Vector data
float Omega_P[3]= {0,0,0};//Omega Proportional correction
float Omega_I[3]= {0,0,0};//Omega Integrator
float Omega[3]= {0,0,0};

// Euler angles
float roll;
float pitch;
float yaw;

float errorRollPitch[3]= {0,0,0};
float errorYaw[3]= {0,0,0};

unsigned int counter=0;
byte gyro_sat=0;

float DCM_Matrix[3][3]= {
  {
    1,0,0  }
  ,{
    0,1,0  }
  ,{
    0,0,1  }
};
float Update_Matrix[3][3]={{0,1,2},{3,4,5},{6,7,8}}; //Gyros here


float Temporary_Matrix[3][3]={
  {
    0,0,0  }
  ,{
    0,0,0  }
  ,{
    0,0,0  }
};
 
 
//functions debugging redfly
 
 void debugout(char *s)
{
#if defined(__AVR_ATmega32U4__)
  Serial.print(s);
#else
  RedFly.disable();
  Serial.print(s);
  RedFly.enable();
#endif
}

void debugoutln(char *s)
{
#if defined(__AVR_ATmega32U4__)
  Serial.println(s);
#else
  RedFly.disable();
  Serial.println(s);
  RedFly.enable();
#endif
}
 
 

 
 
 
void initialize()
{
 //watterod redshield
   uint8_t ret;


  //init the WiFi module on the shield
  // ret = RedFly.init(115200); //br=9600|19200|38400|57600|115200|200000|230400, pwr=LOW_POWER|MED_POWER|HIGH_POWER
  // ret = RedFly.init(pwr) //9600 baud, pwr=LOW_POWER|MED_POWER|HIGH_POWER
  // ret = RedFly.init() //9600 baud, HIGH_POWER
  
  ret = RedFly.init(WIFISPEED,WIFIPOWER);
  if(ret)
  {
   debugoutln("INIT ERR"); //there are problems with the communication between the Arduino and the RedFly
    for(;;); //do nothing forevermore
  }
  else
  {
    //scan for wireless networks (must be run before join command)
    for(int y=0; y<10; y++)
   {
    RedFly.scan();
    ret = RedFly.join("Lacuna", "1JungerWeinUnd20AlteWeiber", INFRASTRUCTURE);
    if(ret)
    {
      debugoutln("JOIN ERR");
      y++;
      delay(1500);
      
    }
    
    else
    {
      if (y==10){
        for(;;); //do nothing forevermore
        }
      
      else{  
      y=10;
      debugoutln("CONNECTED!");
        //osc receive

      
      
      //wieder normal
      ret = RedFly.begin(myIp);
      if(ret)
      {
        RedFly.disconnect();
        for(;;); //do nothing forevermore
      }
      else
      {
      //start server
       server.begin(serverPort);
      
       //set callback function
       server.addCallback("/Eth_ArdOSC/toggle2", &funcOnOff);
      
         pinMode(ledPin, OUTPUT);  
        pinMode(ledRed, OUTPUT);
        pinMode(ledBlue, OUTPUT);
      pinMode(ledGreen, OUTPUT);
      }
      
      
     }
    }
   }
  }
}  

 
void setup()
{
  //wifi connection and osc
  initialize();
 
  //ht
  //delay(1500);
  Serial.begin(115200);
  pinMode (STATUS_LED,OUTPUT);  // Status LED

  
  I2C_Init();

  Serial.println("Pololu MinIMU-9 + Arduino AHRS");

  digitalWrite(STATUS_LED,LOW);
  delay(1500);

  Accel_Init();
  Compass_Init();
  Gyro_Init();
  
  delay(20);
  
... //reading stuff of polulu hat to delete some line for the post


}

void loop() //Main Loop
{
 
  .... //other stuff i had to delete for post
  
  if(server.aviableCheck()>0){
 
  
    }    
 

 }
}
  
void funcOnOf(OSCMessage *_mes)
{
  
     oscRoll=ToDeg(roll);
   oscPitch=ToDeg(pitch);
   oscYaw=ToDeg(yaw);
    
  int value = _mes->getArgInt32(0);
  Serial.print("Value = : ");
  Serial.println(value);
  
  //analogWrite(ledRed,value/2);
  analogWrite(ledBlue,value/4);
  
    //create new osc message
  OSCMessage newMes;
  
  //set destination ip address & port no
  
  newMes.setAddress(destIp,destPort);
  newMes.beginMessage("/head/direction");
    newMes.addArgFloat(oscRoll);
  newMes.addArgFloat(oscPitch);
  newMes.addArgFloat(oscYaw);
  
  //send osc message
  server.stop(); //stop server while sending
  client.send(&newMes);
  server.begin(serverPort); //start server
}

thanks guys
7  Using Arduino / Networking, Protocols, and Devices / Re: TouchOSC via Ardosc/Bonjour on: January 08, 2013, 10:15:28 pm

First, I'm very thankful for your help, great community here.
Second, I solved it  smiley or to be precise someone pointed me to a problem with the ofxOsc library and bundled osc messages, so it was related to Open Frameworks. Here is the link for everyone who runs into the same issues and stumbles over this thread
http://forum.openframeworks.cc/index.php/topic,6563.0.html

so long, nixon
8  Using Arduino / Networking, Protocols, and Devices / Re: TouchOSC via Ardosc/Bonjour on: January 08, 2013, 08:16:55 pm
Seems all to be ok, it's an arduino ethernet board i program with an usb2serial light adapter, the proper board is selectet,  the baudrates are the same. i just read that the build in led is on pin 9, i'm going to test if i can cahnge something, tried it before with an external led, but no luck.
9  Using Arduino / Networking, Protocols, and Devices / Re: TouchOSC via Ardosc/Bonjour on: January 08, 2013, 07:51:48 pm
mh, only alive! in serial monitor. Nothing besides that.

i wonder if this has something to do with library problems, i had an ArdOSC library that was written for the Watterod RedFly wifi shield and i reinstalled this one for the Ethernet board to test the connection. mh but I removed the RedFly ArdOSC folder in my library path to avoid trouble... i think it's a very small problem. all the ports and ip settings seem to be okay. frustrating
10  Using Arduino / Networking, Protocols, and Devices / Re: TouchOSC via Ardosc/Bonjour on: January 08, 2013, 07:32:32 pm
hey, thanks for your help smiley
i've changed the entry in OF -> no change, i placed Serial.println(wert) into the funcOnOff function but now there isn't any serial printout besides alive!

Code:
void funcOnOff(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  //create new osc message
  wert=value;
  Serial.println(wert);
  OSCMessage newMes;
 
 
  //set destination ip address & port no
  newMes.setAddress(_mes->getIpAddress(),destPort);
  newMes.beginMessage("/Eth_ArdOSC/toggle1");
 
  newMes.addArgFloat(value);
  client.send(&newMes);
}
11  Using Arduino / Networking, Protocols, and Devices / Re: TouchOSC via Ardosc/Bonjour on: January 08, 2013, 06:25:51 pm
hi guys, thanks for your wonderful code examples, i m trying to get a connection between open frameworks an an arduino ethernet, i can send data from the open frameworks application and i can receive some data, but not a certain value.  Seems like some problems gavspav had too. I think i have some understanding problem of the addCallback function and things related. I'll also post my open frameworks code too, might be useful.




of in header
Code:
#define HOST "192.168.178.130" //arduino ip
#define RPORT 12000 //incoming
#define SPORT 10000 //outgoing
#define NUM_MSG_STRINGS 100

in cpp
Code:
cout << "listening for osc messages on port " << RPORT << "\n";
receiver.setup(RPORT); //set up receiver
sender.setup(HOST, SPORT); //set up sender




of sending function

Code:
void oscc::sendMessages(){

ofxOscMessage m;
m.setAddress("/Eth_ArdOSC/toggle2");
m.addFloatArg(3.0);
sender.sendMessage(m);
}

the arduino code

Code:

#include <SPI.h>
#include <Ethernet.h>

#include <ArdOSC.h>

OSCServer server;
OSCClient client;

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

int  serverPort=10000; //OF incoming port
int destPort=12000; //OF outcoming port

float wert;
int flag=0;

void setup(){

 Serial.begin(115200);
  Serial.println("DNS and DHCP-based OSC server");
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }
  // print your local IP address:
  Serial.print("Arduino IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
    Serial.print(".");
  }
  Serial.println();
  Serial.println();
  
  //start the OSCserver
  server.begin(serverPort);
  
  //add OSC callback function. One function is needed for every TouchOSC interface element that is to send/receive OSC commands.
  server.addCallback("/Eth_ArdOSC/toggle2", &funcOnOff);
}
  
void loop(){
  
if(server.aviableCheck()>0){
     Serial.println("alive! ");
      Serial.println(wert);
    }    
}


void funcOnOff(OSCMessage *_mes){
  float value = _mes->getArgFloat(0);
  //create new osc message
  wert=value;
  OSCMessage newMes;
  
  //set destination ip address & port no
  newMes.setAddress(_mes->getIpAddress(),destPort);
  newMes.beginMessage("/Eth_ArdOSC/toggle1");
  
  newMes.addArgFloat(value);
  client.send(&newMes);
}




the serial board output (when starting the sending osc function in of by pressing a key):

Code:
ƒóDNS and DHCP-based OSC server
Arduino IP address: 192.168.178.130.

alive!
0.00
alive!
0.00
alive!
0.00
alive!
0.00
alive!
0.00


so it should write 3.00 not 0.00.... smiley-sad


Pages: [1]