Show Posts
Pages: 1 [2] 3 4 5
16  Forum 2005-2010 (read only) / Interfacing / Re: Simple Interrupt on: August 26, 2010, 06:07:28 pm
On my simple sketch I make the pin an output pin, wrote LOW to it, then changed the pin mode to Input, and now the button seems to work correctly;
17  Forum 2005-2010 (read only) / Interfacing / Re: Simple Interrupt on: August 26, 2010, 06:04:19 pm
yes.. i;m realizing that something is not right with my circuit.  I'm no EE, but can code well, when I run a simple button press sketch, with nothing connected, the pin reads high (though occasionally it reads low)  Pressing the button does not change a thing in this simple test.   Again with my simple button press sketch, if I write HIGH to the input (which I believe is supposed to enable the internal pullup resistor), i still get nothing changing when I press the button.   Do I need a pull down resistor to force the line low, so that when I press the button, it goes high?
18  Forum 2005-2010 (read only) / Interfacing / Simple Interrupt on: August 26, 2010, 04:49:18 pm
On my Arduino Mega, I'm trying to create a very simple Interrupt.  Basically every time a button is pressed I want the interrupt to be triggered, and increment a counter.  My code is quite simple..


volatile unsigned long counter;


void buttonPulse()
{

      counter++;
}

// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 20;     // the number of the pushbutton pin
const int IRQ = 3;  // According to the web page on a Mega,  Pin 20 is IRQ 3

void setup() {
      Serial.begin(9600);
      counter = 0;
      attachInterrupt(IRQ,buttonPulse,RISING);

  Serial.println("Enter to continue");
  while (!Serial.available()); Serial.flush();
}

void loop(){
      delay(200);
      Serial.print("Counter=");Serial.println(counter);
}

I have the button wired with 5v on one leg, and the other leg connected to Pin 20 (which should be IRQ 3 on a Mega.

My interrupt never triggers when i press the button. smiley-sad
19  Forum 2005-2010 (read only) / Development / Re: convert pde to cpp on: January 21, 2011, 11:15:32 am
i have makefiles that I use to build things  .  The makefile takes the PDE and applies the requisite things to make a CPP file.. you could easily modify the makefile to just use the sketch.cpp file and not go through the conversion.

It also does the upload.
One thing to note, to make things work with multiple boards, (Mac paths) I make unique copies of the libraries in /Applications/Arduino.app/contents/Resources/Java/Hardware and select those using the MCU variable defined in the Makefile.

PM me with your email and I will send the makefile
20  Forum 2005-2010 (read only) / Development / Re: Creating a static object on: January 21, 2011, 11:25:53 am
I have never gotten any static members of objects (even basic standard types like int) to compile successfuly... What I have done is put anything that needs to be a single instance for any class as a global variable scoped only to my code files which contain the object and methods...  its a hack but it does work.  
21  Forum 2005-2010 (read only) / Development / Re: Duemilanove problem on: August 28, 2010, 11:17:27 am
As an update.. I enabled verbose mode on the IDE for the upload, and the command line for avrdude is EXACTLY the same as my makefile invocation of avrdude.  MCU of atmega328p looks to be the correct spec.  This is now even stranger.

You may wonder why I don;t want to use the IDE,  I'm old school on my code development, preferring VI and command line builds to IDE's
22  Forum 2005-2010 (read only) / Development / Duemilanove problem on: August 27, 2010, 11:22:05 am
I have a very simple sketch where I'm working with the NewSoftSerial library.  If I build and upload  via the IDE it works fine.  I have a makefile and use make upload and avrdude successfully uploads the file (I have tried atmega168 and atmega328p as the MCU target).  When doing this, all I get on the screen is P repeatedly.

The same code works fine when I upload to my Mega (with the proper changes in the  makefile for the correct MCU target.

My suspicion is that its that I'm not specifying the right MCU type for the compilation and upload
23  Forum 2005-2010 (read only) / Development / Re: Makefile for 0018 -- Assember listing on: August 26, 2010, 09:18:32 am
I probably should specify the envionment.. MAC OSX  Gnumake 3.81  It looks like the string substituions are not properly working
24  Forum 2005-2010 (read only) / Development / Re: Makefile for 0018 -- Assember listing on: August 26, 2010, 09:12:34 am
I've based my makefile on the one  here.  I have several CPP files in my source directory.  Make clean keeps deleting the actual source,  I list my files in the variable CXXFILES.  on clean I have added

clean:
      $(REMOVE) applet/$(TARGET).hex applet/$(TARGET).eep applet/$(TARGET).cof applet/$(TARGET).elf \
      applet/$(TARGET).map applet/$(TARGET).sym applet/$(TARGET).lss applet/core.a \
      $(OBJ) $(LST) $(SRC:.c=.s) $(SRC:.c=.d) $(CXXSRC:.cpp=.s) $(CXXSRC:.cpp=.d) $(CXXFILES:.cpp=.d)


Even without this, all my CPP files get deleted, this is because I append my Variable to the CXXSRC variable.   Any clues as to why this is deleting my CPP files.  It seems that the $(OBJ) substitution is also deleting the source files since if I remove everything folllowing $(LST) my files still get deleted


The other thing I'm having problems with is getting libraries to be compiled.  I can add each library source to the makefile, but that seems cumbersom, and the IDE seems to automatically find and build the library
25  Forum 2005-2010 (read only) / Development / Re: IDE can’t fine library includes on: August 25, 2010, 02:20:28 pm
As i have made the softD1307 a library a set of objects and methods, I have named my file softD1307.cpp.  With this, the paths are not found for the libraries.  When I change the name to softD1307.pde  i no longer get include errors.  So something is strange in the IDE when the file is a cpp and how paths are searched.
26  Forum 2005-2010 (read only) / Development / Re: IDE can’t fine library includes on: August 23, 2010, 10:36:51 am
It is in the directory where the others are.  I think the problem is with including the files in a cpp file which i have as part of my sketch directory.  I will experiment with some test.code

27  Forum 2005-2010 (read only) / Development / Re: IDE can’t fine library includes on: August 23, 2010, 06:35:23 am
Version 18 of the IDE,  both Windows and MAC OSX.   The libraries do not show up in the list, which is strange because for all the other libraries which are working, i  just put the directories into the libraries directory.

Note, the softD1307 sample sketch finds the libraries correctly, but my sketch does not.  Again.. quite weird.  unfortunately I'm traveling and don't have the code with me at this time.
28  Forum 2005-2010 (read only) / Development / Re: IDE can’t fine library includes on: August 23, 2010, 06:11:04 am
Actually,  in the C language,  " means search local directories first, then the include path.   <> (chickenlips) means to search only the include path.   I have the includes correct.  if this was a makefile i'd just add the  -I <pathname> to the CC invocation.
29  Forum 2005-2010 (read only) / Development / Re: IDE can’t fine library includes on: August 22, 2010, 01:11:16 pm
I already have the SoftI2cMaster and TwiMaster libraries in the library directory
30  Forum 2005-2010 (read only) / Development / IDE can’t fine library includes on: August 22, 2010, 12:13:00 pm
I;m using the "softD1307" code in a project.  If i use the example code it properly finds the library includes for "SoftI2cMaster".  However when I move the code over to my project, the compiler complains that it cant; find SoftIc2Master.h TWIMaster.h.

If i copy the library code into my sketch directory all works fine.  Normaly this would indicate (in a Makefile world) that I don't have the search paths set up, but I cant figure out how to force the IDE to do this.
Pages: 1 [2] 3 4 5