Loading...
  Show Posts
Pages: [1] 2 3 ... 24
1  Using Arduino / Programming Questions / Re: Accessing a "Wire" object from an interrupt routine == hang, need solution on: April 30, 2013, 09:00:35 pm

If you want to use I2C from within an interrupt routine you will have to write your own (or find one if you're lucky) I2C library that doesn't use interrupts in its operation. 

I'm pretty sure this library doesn't use interrupts:
http://dsscircuits.com/articles/arduino-i2c-master-library.html

It only acts as a master, not slave.  It also uses less memory then wire.h.

2  Using Arduino / Programming Questions / Re: Using .h and .cpp files in same directory as sketch on: April 30, 2013, 11:59:05 am
Variables should be defined in .cpp files. The definition means, in effect: allocate some memory to hold a Button, name it helloButton and initialise it to this value ...
Code:
Button helloButton = Button(2, LOW);

If you need to access a variable from other files, you should add an external declaration in a header file and include that wherever you need to access it. The external declaration means, in effect: the symbol helloButton refers to a Button which is defined in some other file ...
Code:
extern Button helloButton;

In this case you don't refer to helloButton from outside MyLib.cpp so you don't actually need the external declaration.


That's a big help.  Because I moved
Code:
Button helloButton = Button(2, LOW);
to the .ino file per the previous suggestion.  But I got this compile error:
MyLip.cpp: In function 'void readbutton()':
MyLip.cpp:5: error: 'helloButton' was not declared in this scope

So if I add to MyLip.cpp this:
Code:
extern Button helloButton;
Then it compiles fine.
3  Using Arduino / Programming Questions / Re: Using .h and .cpp files in same directory as sketch on: April 30, 2013, 07:54:43 am
Thanks for the clarification.
4  Using Arduino / Programming Questions / Using .h and .cpp files in same directory as sketch on: April 29, 2013, 10:55:16 pm
I'm trying to figure out how to use .cpp and .h files in the same directory as my sketch, but I'm getting compile errors.  I created a simple sketch with 3 files all in the same folder: Include_Lib_Test.ino, MyLib.h & MyLib.cpp.  They use a button library, Button.h which is in my libraries folder

Here's the code for the 3 files

Code:
// Include_Lib_Test.ino
#include "MyLib.h"
#include <Button.h>
void setup() { }
void loop() {
  readbutton();
}

Code:
// MyLib.h
#ifndef _MYLIB_H
#define _MYLIB_H
#include <Button.h>
Button helloButton = Button(2, LOW);
void readbutton();
#endif

Code:
// MyLib.cpp
#include "MyLib.h"
void readbutton() {
  helloButton.listen();
}

I get this compile error:

MyLib.cpp.o: In function `__static_initialization_and_destruction_0':
MyLib.h:5: multiple definition of `helloButton'
Include_Lib_Test.cpp.o:/Applications/Include_Lib_Test.ino:4: first defined here

I attached Button.h and .cpp for reference
5  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: April 29, 2013, 10:34:49 am
It is very hard to help you on a specific project and it is not the purpose of the thread.

Just mention #include <> in both the main sketch and in the library.

I understand.  I didn't know if the LocalLibrary files embedxcode created had some special setting or something that would cause my problem.  I posted on stack overflow, so hopefully I can get it figured out.  I tried your suggestion about about putting #include in the main sketch and library, but that didn't work.
6  Development / Other Software Development / Re: Windows/Linux/Mac Eclipse plugin to compile and upload arduino sketches on: April 29, 2013, 10:29:22 am
The problem you have is with CDT and not with the arduino eclipse plugin.
I think you installed juno and added CDT later. Apparently the C/C++ editor is not properly installed.
Best regards
Jantje

I do have Juno.  I don't know what CDT is.  This is what I installed:
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/juno/SR2/eclipse-cpp-juno-SR2-macosx-cocoa.tar.gz

I did have an earlier version of Eclipse that I never used and moved it to the trash before installing the above.   I guess I could just try to reinstall eclipse.
7  Development / Other Software Development / Re: Windows/Linux/Mac Eclipse plugin to compile and upload arduino sketches on: April 28, 2013, 10:32:29 pm
@scottG
V2 does not work "out of the box" with Arduino 1.0.4. If you copy platform.txt next to boards.txt it might work but I never tried.
Can you share your experiences in getting this to work?

I didn't get too far.  When I double clicked on test1.cpp to edit it, I get an error.  See screenshot. 
8  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: April 28, 2013, 08:12:34 pm
In LocalLibrary.h I have a #include <> for a library in my sketchbook libraries folder, but I get an error that xcode can't find it.  If I remove the include from LocalLibrary.h and put it in the .ino file, it works fine.  I've spent two hours trying to figure out what I'm doing wrong - reading XCode 4 Unleashed, Google searches, but I can't figure it out.  I'll but it's something really simple.  Please help.
9  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: April 28, 2013, 06:04:43 pm
Please find a new release of embedXcode.

embedXcode • Apr 28, 2013 release 47 • Pre-processing variable EMBEDXCODE

A project using embedXcode declares a pre-processing variable, EMBEDXCODE, with the release number as value.

For projects I created with an earlier release of embedxcode, will this pre-processing variable still be set?  If not, how do I implement this feature on projects I've already created?
10  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: April 28, 2013, 05:54:54 pm

panStamp is a whole new platform and is not currently supported by Arduino.

I'd need a couple of these boards so I can investigate and add support to them.

From the IDE perspective, it's the same as Arduino Pro or Pro Mini (3.3V, 8Mhz) w/ATmega 328.  This is the board I select in Arduino IDE when uploading to panstamp
11  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: April 28, 2013, 08:08:07 am
The only solution is to create another folder with the name of the sketch (eg. embed1) and copy the main sketch .ino and all the .h .cpp except main.cpp.

I noticed if in make.cpp, if I comment out:
Code:
//Sketch
#include "MyNewProject.ino"

it will compile in Arduino IDE. 

This isn't a big deal to do when I need too, but I'm wondering if I can conditionally include this line with #ifdef or #ifndef.  Do you know of a defined constant that would be defined when xcode tries to compile this line, but would not be defined if the Arduino IDE compiled it?  Then I could do something like this

Code:
#ifdef XCODE_IS_COMPILING
#include "MyNewProject.ino"
#endif
12  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: April 28, 2013, 07:53:39 am

embedXcode is provided with the path to the tool-chain and no specific operation is carried out concerning one specific file. It is really strange as other files are used.

I need the code of the project to investigate and see what's happening.

It happens when creating a new project. Just put the panstamp library in your libraries folder and create a new project and you should get the same error.  Panstamp library is located here:
http://code.google.com/p/panstamp/downloads/detail?name=panstamp_arduino_1.0.zip&can=2&q=

13  Development / Other Software Development / Re: Windows/Linux/Mac Eclipse plugin to compile and upload arduino sketches on: April 27, 2013, 09:11:51 pm
That did it, thanks.
14  Development / Other Software Development / Re: Windows/Linux/Mac Eclipse plugin to compile and upload arduino sketches on: April 27, 2013, 07:29:09 pm
I'm trying to install the plugin v2 on my Mac (10.7.5).  I have Arduino IDE 1.04.  I downloaded platform.txt from github and put it in the same directory as board.txt (/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/). 

I don't know what you mean in your instructions: "Do not forget to configure (windows->preferences->arduino) or nothing will work. "

I opened eclipse and went to Help > Install New Software and entered the URL: http://www.baeyens.it/eclipse/V2

What is supposed to happen next?  I'm stuck in the Eclipse Install window.  The next button is disabled.  See screenshot.
15  Development / Other Software Development / Re: Arduino on Xcode Project — Official Thread on: April 27, 2013, 06:36:02 pm
I have a library called panstamp.h that won't compile in xcode.  The problem is PRR isn't defined.  It compiles fine in the Arduino IDE.   PRR is defined in Arduino's library iom328p.h
Pages: [1] 2 3 ... 24