Jump to content

How Do I Add Libraries To Energia?

Recommended Posts

So I installed Energia on my Mac, and even though the launchpad isn't listed under the serial ports I can still upload to it for some reason. However when I installed the program it didn't come with a Servo library. So I went to https://github.com/energia/Energia and downloaded the Servo library, poped open the contents of of the Energia program and stuck it with the other libraries. When I try to compile it though I get this error:


/Applications/Energia.app/Contents/Resources/Java/hardware/msp430/libraries/Servo/Servo.cpp:45:27: fatal error: avr/interrupt.h: No such file or directory
compilation terminated.


So basically, How do I add libraries to Energia?

Link to post
Share on other sites

Servo lib has not been ported to msp430 yet hence it was not included in the release. A enhancement request (https://github.com/energia/Energia/issues/69) has been files. pbrier, one of the project members, is working on it.

Once it has been ported a pull request will show up in that ticket. The library will show up in hardware/msp430/libraries once we pull it into master.

Link to post
Share on other sites
  • 1 month later...



I've met the same problem.

Is the servo library available finally ?


optionnally, I can make a one, but I don't want to make something if someone else is already doing it...

maybe it won't be the best one, but I was able to make my stuf move...

Link to post
Share on other sites
  • 1 month later...

I am trying to use the Servo library but am getting a compile error:

core.a(TimerSerial.cpp.o): In function `TimerSerial__TxIsr':
C:\energia-0101E0008\hardware\msp430\cores\msp430/TimerSerial.cpp:202: multiple definition of `__isr_9'
Servo\Servo.cpp.o:C:\energia-0101E0008\hardware\msp430\libraries\Servo/Servo.cpp:87: first defined here
collect2: ld returned 1 exit status


Am I doing something wrong?


Here is my code:

//get a number from Serial and move a servo to that position (no error/limit checking implemented yet)
#define baudrate 9600
#define servoPin P1_4

int inByte = 0;  // incoming serial byte
char inData[3];  // serial input array (buffer)
int index = 0;

Servo myservo;  // create servo object to control a servo

void setup(){

void loop(){
 if (Serial.available() > 0) {
   inByte = Serial.read();
   inData[index] = inByte;
   if (index > 2 || inByte == 10 || inByte == 13){ //buffer is full or we got a charage return or linefeed
     inData[index] = '\0'; //Null terminate the string
     myservo.write(atoi(inData));         // sets the servo position according to the scaled value 
     delay(15);                           // waits for the servo to get there
     index = 0;

Link to post
Share on other sites

I found an example that uses a servo and serial with the g2211, however the code doesn't compile in Energia.


Here is the error I get:

sketch_aug29a.cpp: In function 'void Timer_A1()':

sketch_aug29a.cpp:265:14: error: 'TAIV_TACCR1' was not declared in this scope


...was getting an error about main needing to return an int, so I changed the code to

int main(void)

instead of

void main(void)

which fixed that issue...


Here is the example:


Link to post
Share on other sites
  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...