Show Posts
Pages: [1] 2 3
1  Using Arduino / Networking, Protocols, and Devices / Unable to reset Xbee! on: February 21, 2014, 04:32:27 pm
Hey!
I just received two of the Xbee XB24-Z7CIT-004 modules (https://www.sparkfun.com/products/11217), and two Xbee Explorer Regulated (https://www.sparkfun.com/products/11373).
Both of them worked fine at first, but when i tried to upload some new settings to one of them, it got interrupted and now refuse to communicate with X-CTU.
After some searching I noticed that this is common among the Xbee's, and that it's possible to fix it by following some simple steps combined with a reset.
The most common method for resetting an Xbee seems to be this one from intractables http://www.instructables.com/id/Changing-Xbee-Baud-Rates/step5/Un-bricking-a-frozen-Xbee/, but this and all other methods that I've tried doesn’t work for me.
It seems like shortening the reset pin to ground isn’t doing anything, and I tried this on the functioning Xbee as well.

Anny suggestions of what the problem might be?
It feels like I've tried everything!
All help is appreciated!
2  Using Arduino / Programming Questions / Re: Library error on: September 01, 2013, 07:15:22 am
Thanks! It worked now smiley
3  Using Arduino / Programming Questions / Re: Library error on: August 31, 2013, 09:39:18 am
It does no good to ask about errors in the sketch if you don't post the sketch. None of the errors shown have anything to do with the library per se.

I've updated the first post with all the code that I use, as I mentioned in my last post.
4  Using Arduino / Programming Questions / Re: Library error on: August 31, 2013, 09:04:20 am
I've updated the first post now, as I added a constructor to the code, (empty).
However, I got a new error message: "sketch_aug31a.cpp: In function 'void loop()':
sketch_aug31a:12: error: request for member 'altitude' in 'foo', which is of non-class type 'Altitude ()()'"
5  Using Arduino / Programming Questions / Re: Library error on: August 31, 2013, 08:57:38 am
Code:
void Altitude::altitude()
Names are case sensitive. The constructor name MUST be the same as the class name.

Oh, that's not the constructor, its a method.
I have no constructor, cause I didn't thought it was necessary as I have no value to pass?
But if I have to, what should my constructor contain?
6  Using Arduino / Programming Questions / Library error on: August 31, 2013, 08:01:35 am
Hi!
When I try to use my library that I've made, I get this error message: "sketch_aug31a.cpp: In function 'void loop()':
sketch_aug31a:12: error: request for member 'altitude' in 'foo', which is of non-class type 'Altitude ()()'"
, and I cant really figure out what's causing this?
All help is appreciated!

Code:
#include "Arduino.h"
#include "Altitude.h"

float z;  // Height in meters
float T = 285; // Kelvin @ Air temp
float po = 101325;  // Pascal @ Sea level
float p = 45000;  // Pressure @ height
int R = 8.3144621; // Universal gas constant
int M = 28.97; // Moles @ Molemass of air
int g = 9.82; // m/s^2 @ Gravity
int pressureChange = 200; // Pascal


Altitude::Altitude()
{

}
void Altitude::altitude()
{
  if(p > 0)
  {
    z = (R*T/g*M)*log(po/p);  // Biometric altitude formula
    Serial.print(z);
    Serial.println(" meters above sea");
    delay(1000);
    p = pressureChange--;  // Decrease pressure over time (faking pressure sensor).
   }
   else
   {
     Serial.println("No Pressure");
     delay(1000);
   }
}



Code:
#include "Arduino.h"

#ifndef Altitude_h
#define Altitude_h

class Altitude
{
  public:
void altitude();
  private:
float z;
float T;
float po;
float p;
int R;
int M;
int g;
int pressureChange;
};

#endif

Code:
#include <Altitude.h>

Altitude foo();

void setup()
{
  Serial.begin(9600);
}

void loop()
{
 
  foo.altitude();
}

7  Topics / Robotics / Re: Tables instead of radians? on: August 16, 2013, 08:58:13 pm
Nevermind, I solved it smiley
At first, I did for some reason thought that the radian was the output value, when it in fact was the input value.
So it was just about to create a function that converts degrees to radians by using the formula you gave me.

Thanks for your help!
8  Topics / Robotics / Re: Tables instead of radians? on: August 16, 2013, 06:53:54 pm

Why not just convert the returned value into degrees?
Two Pi radians is 360 degrees.
what are you looking for ...

like radians to degrees is as simple as d = r*(180/pi)

Hey!
I do not want a returned value into degrees, as my input value already is in degrees.
Instead, I want values from the cosine table like this https://www.grc.nasa.gov/WWW/k-12/airplane/tablcos.html.
9  Topics / Robotics / Tables instead of radians? on: August 16, 2013, 06:29:22 pm
Hey!
I'm working on a navigation-algorithm for my robot, including law of sines and law of cosines.
However, I do not get the right results from my formulas as the cos,sin and tan functions from Arduino only return degrees in radians.
That's why I'm asking if there's any functions that can give me return-values from the cos,sin and tan tables instead of radians?

Thanks in advance,

// Andreas
10  Using Arduino / Sensors / Re: LSM303 compass problem! on: August 03, 2013, 07:43:43 am
I've tried Adafruit's library now as well, and it's not working either..
Please help!
11  Using Arduino / Sensors / LSM303 compass problem! on: August 01, 2013, 11:56:47 am
Hi!
I've just bought the LSM303 https://www.sparkfun.com/products/10888.
It should have been an easy process to calibrate the compass with the library https://github.com/pololu/LSM303, but certainly not for me.
When I use the "calibrate" sketch included in the library, which reads the max/min value from the compass, I'm just getting minimal changes in the values,if any at all, even tough I rotate every axis:
Code:
M min X: -8 Y: -4096 Z: -256 M max X: 16 Y: 3 Z: 3
and this happens after a while if I do nothing at all:
Code:
M min X: -255 Y: -4096 Z: -256 M max X: 16 Y: 4 Z: 255
So instead I've been trying the "serial" sketch, which just reads the raw data from the compass.
From that data, I've noticed  that the values from the accelerometer do change, while the values from the magnetic sensor pretty much stand still, just like the calibration-values:
Code:
A X: 786 Y: 483 Z: 447 M X: -2 Y: -4096 Z: -1
A X: 775 Y: 477 Z: 431 M X: -2 Y: -4096 Z: 0
A X: 772 Y: 480 Z: 437 M X: -2 Y: -4096 Z: -3
A X: 764 Y: 469 Z: 439 M X: -2 Y: -4096 Z: -1

What have gone wrong here? Could the magnetic-sensor on the compass have been damaged or something?

All help and suggestions is appreciated!

// Andreas

Edit:
The compass was shipped together with a vacuum pump and a liquid pump, who both cause pretty decent magnetic fields with values over 1000 microTesla (measured with phone).
Could this have damaged the magnetic sensor on the compass?..
12  Using Arduino / Networking, Protocols, and Devices / Re: Serial is not working! on: July 28, 2013, 03:47:40 pm
But then why isn't the Uno reacting at all?..

Maybe it's your sketch?

Code:
if(Serial.available() > 0)
{
    reader = Serial.read();
    if(reader == 0x31)   // hex code for numeral 1
    {
       digitalWrite(4, HIGH);
    }
}

Once it gets a '1' then D4 will go on, so I assume you can send it a '2' or other characters or modify it to toggle or turn off otherwise.

Haha, I found out the problem!
All the time I've thought that D1 was RX and vice versa instead of D1 being TX.
The reason for this is because in the manual for the Wild Thumper Controller, it says D1 - RX and D0 - TX, which is obviously wrong.
http://letsmakerobots.com/files/Wild_Thumper_Controller_Instructions.pdf

Thanks a lot for your help!

// Andreas
13  Using Arduino / Networking, Protocols, and Devices / Re: Serial is not working! on: July 28, 2013, 03:26:40 pm
I was modifying my previous Reply, but while you were composing yours

Following, I'll restate what I'd added:
If you just want to verify results of the test sketch above (seeing is believing), remember that the output (TX) from D1 is normally high - place an LED with its anode to +5 and its cathode going to D.  A resistor isn't needed because D1 and D0 have on-board resistors (600Ω) between the output header and the ATmega328 pins.

Humm, yeah it actually blinks!  But then why isn't the Uno reacting at all?..
14  Using Arduino / Networking, Protocols, and Devices / Re: Serial is not working! on: July 28, 2013, 02:55:59 pm
If you look at one of the schematics ("the board" == Arduino whichever, Uno, Nano, etc) you'll see that those LEDs aren't connected to D0 / D1 at all.
D0 & D1 are routed back to the USB interface IC, yes, but the LEDs are connected to two entirely different pins on the USB interface IC.
They 'blinkle' only when the USB is connected, indicating USB comms activity.

Uploading a simple sketch --

Code:
void setup ()
{
  Serial.begin(9600);
}

void loop ()
{
  Serial.print("A");
  delay (1000);
}
demonstrates this much.

When connected to the USB, the on-board "TX" LED shows activity.
But when disconnected from USB and powered through the barrel jack, there is no "TX" LED activity.

Alright, but even though the LED's aren't supposed to blink, I can still not get the serial communication itself to work.
I've done some sketches for testing purposes, trying to power a LED trough serial, but without success.


Code:

// Code for Wild Thumper Controller

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.println('1');
  delay(100);
}



Code:

// Code for Arduino Uno

void setup()
{
  Serial.begin(9600);     
  pinMode(4, OUTPUT);
}

void loop()
{
  int reader = Serial.read();   
 
  if(reader == '1')
  {
    digitalWrite(4, HIGH);
  }
 
  delay(100);
}



Do you have any suggestions?

// Andreas
15  Using Arduino / Networking, Protocols, and Devices / Re: Serial is not working! on: July 28, 2013, 09:18:39 am
The RX and TX LEDs only indicate the comms via the USB, they're not status indicators for activity on D0 and D1.

I may not have this right, but I think you'd have to modify the board to power the USB IC.  As built, it only gets power from the USB cable.  V_USB can power the board, but powering the board through Vin or the external barrel connector does not feed the V_USB.

Hey!
I was pretty sure that the LED indicators lit up when communicating with each other before, but maybe I remember wrong.
When it comes to the power supply: which board are you referring to that wouldn't work with external power?
Arduino have an built in DC plug for external power with a recommended input voltage of 7-12V, where I use a 9V battery.
The same goes for the Wild Thumper Controller, which is pretty much made for external use on RC cars @ 7,2 V, where I use a 7,2 V RC battery.
In fact, you cannot even run the Wild Thumper board with power from USB, since it's only 5V.

And as I mentioned: everything has been working fine earlier, so I don't know why it wouldn't work now..

// Andreas
Pages: [1] 2 3