Show Posts
Pages: 1 ... 49 50 [51] 52 53 ... 150
751  Community / Bar Sport / Re: Million-and-one noob q:s about Programmers, Programs, Programming and Pragmatism on: January 11, 2014, 08:36:44 pm
As for loop and setup, there is no need to re-write main.h/.cpp if you use the IDE or .cpp files in another compiler. C++ supports function overloading so you can simply provide your own int main() in your local files.

I have started an article on using int main() in relation to the IDE: http://arduino.genx.biz/FAQ/content/2/2/en/can-i-use-int-main-with-arduino.html
752  Development / Other Software Development / Re: Sublime Text and Stino: Best IDE you can have. on: January 11, 2014, 07:34:40 pm
SPI_CONTINUE and SPI_LAST do not appear to be in the Arduino package ( 1.0.5 ). You might have left out/improperly included a library and/or sublime might not define something that is used to conditionally include the SPI_x symbols.
753  Using Arduino / Programming Questions / Re: does not name a type problem on: January 11, 2014, 04:20:54 am
Don't mix case!!!

Switch != switch

You can't use switch as it is reserved, your library folder must be Switch, same as the header and source files.
754  Development / Other Software Development / Re: Simulator for Arduino v0.98 on: January 11, 2014, 03:32:59 am
Does the 150 lines include empty or small lines ( maybe a single bracket ) or libraries?
755  Using Arduino / Project Guidance / Re: Arduino Error "error: 'class _Esplora' has no member named 'readTK' " on: January 11, 2014, 03:24:38 am
What is your code, I can only assume the code below, which has no problems compiling:

Code:
#include <Esplora.h>

void setup() {}

void loop() {}

There is no readTK in the Esplora library (1.5.2), you must have that symbol somewhere in your code. Have you also changed the board type to Esplora?
756  Community / Website and Forum / Re: Can anyone else verify this font size shrinking problem? on: January 09, 2014, 10:55:08 pm
Its not a bb tag causing the problem. His signature has been truncated leaving a half finished piece of HTML

Fixed, thanks for the hint.


No worries, happy to help out.
757  Using Arduino / Programming Questions / Re: format output for char * on: January 09, 2014, 07:59:14 pm
printf returns a count, not an array of chars.

look at sprintf to format to your own buffer ( char[] ) that you can then pass to the function.

http://www.cplusplus.com/reference/cstdio/sprintf/

No float support in AVR Arduinos though ( sprintf ), look at recent posts, this was discussed yesterday I think.
758  Using Arduino / Programming Questions / Re: initializer but incomplete type error on: January 09, 2014, 07:24:57 pm
Have you declared 'radio'

Code:
RF24 radio(9,10);

http://maniacbug.wordpress.com/2011/11/02/getting-started-rf24/
759  Using Arduino / Programming Questions / Re: Why cant' I break out of prison? on: January 09, 2014, 07:19:20 pm
does that even compile for you, you  seem to have output down the bottom, which is not from that code!
Function calls and code in file scope is not C++, what libraries do you use?

also, ~true does not return false.

Code:
while( !clockInterrupt ) {
}
760  Development / Other Software Development / Re: cannot display all examples IDE 1.0.5 on: January 07, 2014, 08:07:09 pm
Where ever your examples are, place some into an additional folder ( at their location ) so there isn't too many in the one folder.

Then restart the IDE, hopefully like mine, the additional folder becomes a sub menu in the IDE. This is fixed I think in the 1.5.x versions.
761  Using Arduino / Programming Questions / Re: Complex IF statements with boolean on: January 07, 2014, 07:57:21 pm
Simplify that block of syntactic pudding just so you can understand your own code.

You repeat the first checks, also writing it backwards save re checking the same thing over and over.

This is just an example, you can cram it all inline like yours if you like.
Code:
if( DHT.humidity >= 65 ){

}else if( DHT.humidity >= 60 ){  //The check above implies that the value is less than 65, therefore no need to check.

}else if( DHT.humidity >= 50 ){  //Ditto

}

If you are getting more than one alert, it is the code surrounding it that we need, there is clearly only one alert message here.
762  Development / Other Software Development / Re: where to post new library on: January 07, 2014, 07:22:33 am
You can post your library in this 'other software development' section, you are not restricted to it however, post where ever seems relevant to what your library does, just try not to cross-post unless each thread can contain section specific usage, rather than just repeating. You can also create an article for it in the playground: http://playground.arduino.cc/

Either way you still should post about it somewhere just so people know its there.
763  Using Arduino / Programming Questions / Re: Prime VFD not compiling HELP! on: January 06, 2014, 05:32:13 pm
Don't worry it will, there are more bugs, don't know how it was tested to compile. It clearly doesn't.

You will need to open PrimeVfd.cpp & PrimeVfdInterrupt.cpp and replace one include.

Replace:
Code:
#include "WProgram.h"

With:
Code:
#include "Arduino.h"

In both files.

After doing this:
Quote
Binary sketch size: 3,688 bytes (of a 32,256 byte maximum) - 11% used
764  Using Arduino / Programming Questions / Re: Prime VFD not compiling HELP! on: January 06, 2014, 05:23:37 pm
What version is your IDE, it appears they provide an updated version for you:

Quote
PrimeVfd.zip Version updated for Arduino 1.0 and later. Tested to compile only, no other testing has been done.
PrimeVfd-Old.zip For Arduino versions prior to 1.0. Tested with samples on hardware.

And the new version has the correct prototype:
Code:
virtual size_t write(uint8_t character);
765  Using Arduino / Programming Questions / Re: structures and object oriented programming help on: January 06, 2014, 07:30:24 am
Not meaning to pinch the thread, but this seems inline and a bit more substantial compared to 'yes'.

Unions are objects just the same as classes and structs. To provide an insight as to where a member function may be useful in a union this example uses a conversion operator to provide an alternative to supporting the Printable base class. It will serialize anything using a union.

Then you can print or write it to anything supporting the print library.

Code:
template< typename T >
  union Serialize{
    T Obj;
    byte Data[ sizeof( T ) ];
    
    operator byte*(){ return this->Data; }
    operator char*(){ return ( char* ) this->Data; }
    size_t size() { return sizeof( T ); }
};

struct UnPrintable{
  int a, b, c, d, e, f, g;
};

void setup() {
  
  Serial.begin( 9600 );
  
  UnPrintable u = { 'ba', 'dc', 'fe', 'hg', 'ji', 'lk', '\0m'  };

  Serialize< UnPrintable > s = { u };
  
  Serial.println( s ); //Look it prints.
  
  //Or if there is no null at the end.
  Serial.write( s, s.size() );
}

void loop() {}

As unions allow initializing the first member, you can remove the duplicated memory and just use the union.
Code:
Serialize< UnPrintable > s = {{ 'ba', 'dc', 'fe', 'hg', 'ji', 'lk', '\0m'  }};
Pages: 1 ... 49 50 [51] 52 53 ... 150