Show Posts
Pages: 1 ... 50 51 [52] 53 54 ... 149
766  Using Arduino / Programming Questions / Re: ProgMem store Unsigned Long data on: December 31, 2013, 01:15:06 am
Didn't see your setup(), unsigned longs are 4 bytes, you read only one.

DEC: 11111
BIN: 10101101100111

the highlighted part as a single byte is 103

use pgm_read_dword()
767  Using Arduino / Programming Questions / Re: ProgMem store Unsigned Long data on: December 30, 2013, 11:29:35 pm
make the integer literal ( the number ) an unsigned long using a type suffix.
unsigned long mydata[] PROGMEM =

You can do the same with floats and others:
float f = 123.456F;
int i = 0xAABB; //Not needed
unsigned long long u = 0x1A7EBADF00DULL;

u requires the 'ULL' as the integer literal will be taken as a 32-bit or long.
768  Using Arduino / Programming Questions / Re: Syntax Help on: December 30, 2013, 03:47:46 am
Below shows a class declaration with a function declaration. Below that is the function definition for the declaration. The class name is used in conjunction with the scope operator '::' to form the function definition. Without it the function would be an ordinary non-member function.

//In a header file
struct Imon_INA220{
  void wireReadRegister( uint8_t reg, uint16_t *value );

//...In a cpp file somewhere
void Imon_INA220::wireReadRegister(uint8_t reg, uint16_t *value)
769  Using Arduino / General Electronics / Re: Rabbit killer on: December 30, 2013, 01:55:57 am
Buy/inspect a cheap fly zapper, then just use more powerful components. Will see if I can get a photo of mine.
770  Community / Website and Forum / Re: Can anyone else verify this font size shrinking problem? on: December 30, 2013, 12:46:54 am
Its not a bb tag causing the problem. His signature has been truncated leaving a half finished piece of HTML, also robtillaart is right, everything below inherits the styles of the unclosed element, the link I posted is so dramatic because he posts like 6 times on the one page.

This is what will happen to many other signatures including mine if they truncate them all to 150 chars.

146 chars for this sig:
<a rel="license" href="

sa/3.0/"><img alt="Creative Commons License" style="border-

width:0" src="ht</div>

As my browser shows, the sigs are normally smaller in font size, and the highlight above shows the closing div for the signature in a string, so it is skipped. Each time the dude posts, the text is lowered that little bit more.

As a website owner myself I can see that this is a terrible position to be in. For example one could exploit the shortened signature to inject a Javascript causing everyone to give false karma to the attacker, not to mention wreak absoulte havoc on the site using reputable logins
771  Community / Website and Forum / Re: Can anyone else verify this font size shrinking problem? on: December 29, 2013, 07:04:24 am
Found the problem anyway, it is this guys signature that messes the page up & all others with posts on it.;u=28809

I would say it is down to the test being done on signature lengths, and has been truncated.
772  Community / Website and Forum / Can anyone else verify this font size shrinking problem? on: December 29, 2013, 06:53:23 am,95914.0.html

At the start of the page, post text is 15px in size, which slowly shrinks down to 9px in size.
773  Using Arduino / Programming Questions / Re: String "Limiter" function on: December 29, 2013, 03:37:48 am
It is easy to add that functionality in by deriving the string class, however, I do not understand your example:

string= "1234567890abc"
out=string.limiter(0,4) ;    //start, stop

result: out="90abc"

'9' is neither the 'zero'th' character from either end of the string, nor is 'c' the fourth, maybe the 4 is a length? Can you explain what your wanted function is actually doing?
774  Community / Website and Forum / Re: Identify OPs posts within a thread - different colour, perhaps? on: December 28, 2013, 07:33:56 pm
I agree with this idea. I however would opt for the entire background of all the thread starters post's be a different colour, not heavy, just a shade of colour.
775  Using Arduino / Programming Questions / Re: Creating a struct from an initializer list on: December 27, 2013, 07:27:51 am
That isn't an initialization, it is an assignment as the object is already initialized. Also the solution is not a cast, rather a 'Compound literal'

Usually, the specified type is a structure. Assume that struct foo and structure are declared as shown:

     struct foo {int a; char b[2];} structure;
Here is an example of constructing a struct foo with a compound literal:

     structure = ((struct foo) {x + y, 'a', 0});
This is equivalent to writing the following:

       struct foo temp = {x + y, 'a', 0};
       structure = temp;
776  Using Arduino / Programming Questions / Re: Alternative serial monitor on: December 27, 2013, 12:49:40 am
The best monitor I have used is called Hterm. It is by far the most feature full monitor I have used ( far better than many paid alternatives ).

Here is a thread I started a while ago asking a similar question. Hterm was recommended there.
Free serial monitor / serial data capture applications. Recommendations?
777  Topics / Home Automation and Networked Objects / Re: router on: December 24, 2013, 09:21:50 pm
I have used this method for a while, its a nice and cheap alternative. Also very stable compared to the official Wifi shield as that does not properly support transport protocols and fails easily.

I have also wanted to try a router with multiple ports. Using an Ethernet to USB adapter ( for networked USB ) I'm hoping to be able to upload sketches remotely via Ethernet. Got my hands on an old goat (DSL-G604T) to test in the new year.
778  Development / Other Software Development / Re: Best way to determine CPU type at compile time? on: December 24, 2013, 08:49:53 pm
This is how I do it in one of my multi-platform libs ( the AVR section anyway ), I think fat16lib did the hard work of gathering up all the processor defines.

This is what it can detect now.
* ATmega
  - 32u4
  - 168
  - 168p
  - 328p
  - 644
  - 644p       
  - 1280
  - 1284p       
  - 2560

  - 646
  - 1286

// 168 and 328 Arduinos
#if defined(__AVR_ATmega168__) ||defined(__AVR_ATmega168P__) ||defined(__AVR_ATmega328P__)
  #define CHIPSET ATmega_168_168P_328P
// Mega 1280 & 2560
#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
  #define CHIPSET ATmega_1280_2560
// Sanguino
#elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)
  #define CHIPSET ATmega_644_644P_1284P
#elif defined(__AVR_ATmega32U4__)

  // Teensy 2.0
  #ifdef CORE_TEENSY
#define CHIPSET ATmega_32U4_A

  // Teensy
#define CHIPSET ATmega_32U4_B
// Teensy++ 1.0 & 2.0
#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
  #define CHIPSET AT90USB_646_1286


You can remove the CHIPSET define and the file include, then fill in with your own design.
779  Using Arduino / Programming Questions / Re: Nesting vs Flow on: December 24, 2013, 02:08:28 am
Exceptions are actually quite the opposite. They provide a safe mechanism to recover from an error/loss of state by unwinding the stack ...

Unwinding the stack, and killing the stack, seem the same to me (in a sense). You are discarding stack entries.

Its not discarding it at all. The purpose of stack unwinding is to call the destructors of the objects that reside in the stack, allowing them to finish and free their memory and so on.
780  Using Arduino / Programming Questions / Re: variables global,local,static and constants on: December 24, 2013, 01:49:20 am
What pYro_65 said shouldn't been trivialized.

What exactly are you referring to?
Static locals have the same scope as auto locals, the benefit is persistence.
File scope/member static variables are limited to the scope they are defined in.
Also local statics have no implication on code size, how it is used determines the potential for optimization.
Pages: 1 ... 50 51 [52] 53 54 ... 149