Adding External Libraries

I am wanting to use the contrains library. I downloaded it and place the constrains folder in /hardware/libraries Then according to the instructions, I should be able to see it when I go to SKETCH - IMPORT But its not listed ..

What am I doing incorrectly ??

Randy - N2CUA

What am I doing incorrectly ??

Putting a user library in the wrong place. User libraries go in the libraries directory of your sketchbook directory. Create one if you need to.

What OS are you using? Where did you get the library?

You also need to restart the Arduino IDE after you install it if you have it open when you drop the files.

Thanks for replying so quickly .. :) I put the library in the place mentioned on the Arduino site. I also believe thats where I got the library from .. I have tried also the default library folder in the Arduino IDE folder structure. I will go back in there and see if the file types and folder layouts for the default libraries match the constrains one that I am trying to use .. Windows 7 and Arduino IDE 1.0.1

Randy - N2CUA

Well ok .. I have it in there now .. I thought I restarted it .. I put it in both locations .. Not sure which one it is seeing .. But .. not sure I care so long as its working .. ;)

Thanks all ..

Update ... the constrain.h file has an include of WProgram.h WHICH .. cant be used in this version of IDE .. So have to use Arduino.h Fine .. now when I include and compile .. I get other errors .. Not sure this is getting to be worth the effort .. Nothing on the Arduino site mentioning version differences on the page where the Constrain library is downloaded .. Getting a bit frustrated LOL Can someone send me a known working sketch with contrains in it for IDE 1.0.1 ??

RJ3819 @ yahoo.com ( w/o spaces )

I'm not familiar with the constrain library, what's it's purpose?

Fine .. now when I include and compile .. I get other errors ..

Which you don't show.

Not sure this is getting to be worth the effort ..

Well, if you can't be bothered, can you realistically expect us to be? Especially since you haven't told us where you got this library?

Nothing on the Arduino site mentioning version differences on the page where the Constrain library is downloaded ..

Where is that page? Like Arrch, I've never heard of this library.

Arrch: You also need to restart the Arduino IDE after you install it if you have it open when you drop the files.

I really hated to do that! Really!

I just love childish, unproductive sarcasm .. ( not ) I believe I mentioned it was on the arduino site .. Not sure why you speak of "us" being bothered as everyone else seemed just fine trying to assist .. Which I thank everyone for .. very much ..

Soooooooooo heres the link .. http://www.arduino.cc/playground/Code/Constrain

Heres all the errors .. Its just the errors .. Possible that its still an issue with compatibility between versions? Its not biggie .. Was just trying to constrain the values on my SWR display .. I appreciate everyones help ..

In file included from C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\libraries\Firmata/Firmata.h:16, from AnalogFirmata.cpp:20: C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\libraries\Firmata/Boards.h: In function 'unsigned char writePort(byte, byte, byte)': C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\libraries\Firmata/Boards.h:355: warning: no return statement in function returning non-void

In file included from C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\libraries\Firmata\/Firmata.h:16, from C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\libraries\Firmata\Firmata.cpp:17: C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\libraries\Firmata\/Boards.h: In function 'unsigned char writePort(byte, byte, byte)': C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\libraries\Firmata\/Boards.h:355: warning: no return statement in function returning non-void

C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\hardware\arduino\cores\arduino\HardwareSerial.cpp: In function 'void store_char(unsigned char, ring_buffer*)': C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\hardware\arduino\cores\arduino\HardwareSerial.cpp:82: warning: comparison between signed and unsigned integer expressions C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\hardware\arduino\cores\arduino\HardwareSerial.cpp: In member function 'virtual size_t HardwareSerial::write(uint8_t)': C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\hardware\arduino\cores\arduino\HardwareSerial.cpp:390: warning: comparison between signed and unsigned integer expressions

C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\hardware\arduino\cores\arduino\Print.cpp: In member function 'size_t Print::print(const FlashStringHelper*)': C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\hardware\arduino\cores\arduino\Print.cpp:44: warning: 'progmem__' attribute ignored

C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\hardware\arduino\cores\arduino\Tone.cpp:108: warning: only initialized variables can be placed into program memory area

Fine .. now when I include and compile .. I get other errors .. Which you don't show.

Quote

Not sure this is getting to be worth the effort .. Well, if you can't be bothered, can you realistically expect us to be? Especially since you haven't told us where you got this library?

Quote

Nothing on the Arduino site mentioning version differences on the page where the Constrain library is downloaded .. Where is that page? Like Arrch, I've never heard of this library.

The first message seems pretty easy to understand:

In function 'unsigned char writePort(byte, byte, byte)':

The function is designed to return a value, an unsigned char.

warning: no return statement in function returning non-void

But, there is no return statement to actually return that value.

In file included from C:\Users\Randy\Documents\Arduino\Arduino-1.0.1\libraries\Firmata/Firmata.h:16, from AnalogFirmata.cpp:20:

I did not realize that this issue dealt with Firmata. That explains a lot. Good luck resolving all the issues. No one appears to be supporting Firmate for the Arduino.

Well .. as I said ... though I appreciate the answers .. Looks like its not easily solvable and Paul I am confused as to why you say its not supported .. Can you send me a link ? In my arduino folders structure for version 1.0.1 there is a Firmata folder with files in it.. Why are they including ( no pun intended ) them if they arent supported ? Backward compatibility perhaps ?

Anyways ... perhaps I can just look at the constrains.h file and see how they are doing it and just include the code in my sketch ..

Thanks for everyones inputs .. I'm new to all this so everything will be a learning experience for me for awhile ..

Randy

Side note here .. Interestingly enough .. The use of constraints in code is mentioned in my "Beginning Arduino Programming" book ..

Take Care all ..

Randy

I am confused as to why you say its not supported

Well, I've been a relatively active participant in this forum for a couple of years, and, during that time, I've not seen a single comment like "Oh, hey, thanks for letting me/us know of the problem. We'll get right on fixing that." or "Hey, that's a great idea. I'll/we'll get that incorporated as soon as possible.". So, it does not appear to me as though anyone is actively supporting it.

Just asking .. Nonetheless, I think my question is still valid .. If its not supported, why is it in the latest release?

Anyways…
Seeing as this is going nowhere fast …
I did see an email address in that constrains.h file …
so I will give a shot at emailing him and ask if he can help

Thanks all …

Randy

Actually …
I got the constrain to work without the library …
CODE : ( just what applies to the constrain )
Didnt include entire code …
But glad it worked …
Constraining the SWR value to never go over 10
on the display …

Again … I’m new … so its exciting … :wink:

Declarations :

float power = 0.0;
float swr = 0.0;
float pin_volt = 0.0;
int volt_raw = 0.0;
float volt = 0.0;
//*********************
float swrP = 0;
float rho = 0;
float swrvolt = 0;
float PwrV = 0;
//*******************
const int minSwrp = 1;
const int maxSwrp = 10;

// SWR section

swr_raw = 0;
{
for (int i = 0; i < span; i++)
swr_raw = swr_raw+analogRead(swr_pin);
swr_raw = swr_raw / span;

swrvolt = ((swr_raw * 5.0) / 1024.0);
swrvolt = (swrvolt*20);
swrP = ((sq(swrvolt) / 50));

rho = sqrt(swrP/power);
swr = ((1+rho)/(1-rho));
swr = constrain(swr, minSwrp,maxSwrp);

lcd.setCursor(0,1);
lcd.print(" VSWR=");
lcd.print(swr,1);
lcd.print(":1");
lcd.print(" ");

lcd.setCursor(9,0);
lcd.print(" RP=");
lcd.print(swrP,1);
}