Show Posts
Pages: 1 ... 52 53 [54] 55 56 ... 150
796  Community / Bar Sport / Re: Can you actually buy these anywhere?? on: December 24, 2013, 01:27:50 am
Rarities... Arduino UNO R3 ATmega328P: $113.75 in eBay. Seems to be the OEM.

It clearly says its a clone, its just a claim to high quality.  It is a mistake, if you look at the previously sold list they went for $13.75

http://www.ebay.com/itm/UNO-R3-ATmega328P-ATmega16U2-Free-Cable-for-Arduino-FAST-US-QUALITY-SHIP-/181233924280?pt=LH_DefaultDomain_0&hash=item2a326238b8
797  Using Arduino / Programming Questions / Re: variables global,local,static and constants on: December 24, 2013, 12:38:49 am
Either variable is subject to optimization.

If the compiler can see that nothing writes to them it may evaporate into load data commands and use no ram at all.
The compiler can do the least with it if you take a reference/pointer that the compiler cannot follow; something like an array of pointers where the index used to access it may come from an external/interrupt source ( analogRead, switch,... ).

The compiler doesn't need "const" to optimize out things that are blatantly obvious either. Infact sometimes you have to use "volatile" to stop it from doing so.

EDIT: Globals have lots of things that can cause nasty headaches, if only one function/scope needs the persistent data then go for the local static.
798  Using Arduino / Programming Questions / Re: Nesting vs Flow on: December 24, 2013, 12:26:36 am
The stack space is used for this, each function call is "pushed" onto the stack, when it returns it is "popped" from the stack.
As the callee of a called function hasn't returned its data is still on the stack.

So the memory position ( in the stack ) before a function is the stack space for the function that called it, this may include saved register states between calls.

The stack actually starts at the end of RAM and grows backwards, just switch the meanings of before and after and you're fine smiley

The recursion limit is based on memory exhaustion, AVR's have the bonus of not having program space in ram so you can recursively call small functions many times before a considerable amount of memory is  used.
799  Community / Bar Sport / Re: Can you actually buy these anywhere?? on: December 24, 2013, 12:11:13 am
You've made  no mention of the price you wish to pay. Do you mean New York when you say big apple? If so I do not really believe that New York only has one reasonably priced retailer.

What about Ebay?
Whats wrong with these knock offs:
  • Pro Mini $2.95
  • Uno $5.99

    The board may be of a lesser quality ( quite good in my  experience ), but the processor is still made by Atmel.
800  Using Arduino / Programming Questions / Re: variables global,local,static and constants on: December 23, 2013, 11:26:29 pm
Using a static variable in a function has no different implications to a global variable ( to the function with the static var ). Everything else however will either not see the variable, or have access to it, depending on weather its static or global respectively.
801  Using Arduino / Programming Questions / Re: simple loop logic quesiton on: December 23, 2013, 06:19:26 am
Quote
what is the problem here?
 when SC=10, then SC-1=9, then stLED[9]=0 should go LOW

SC never has a chance to be decremented to 9, you set it to zero then subtract one:

Quote
if(SC==10){
SC=0;
stLED[9]=0;}

stLED[SC-1]=0;
stLED[SC]=1;
802  Using Arduino / Programming Questions / Re: PROGMEM array of structs on: December 23, 2013, 05:30:05 am
String literals need to be placed into memory separate, otherwise you still have it in RAM, but you can use an additional struct to combine the three, then you only need one array. Here is  an example using a single element ( not an array ). but expanding to an array is simple:

Code:
struct WordMap{
  char* name; // identifier
  uint8_t row; // the row number (0-7)
  uint16_t rowPos; // two bytes of positions that should be on or off (16 positions available)
};

struct HourMap{
  uint8_t name;
  uint8_t row;
  uint16_t rowPos;
};

struct MinuteMap{
  uint8_t name;
  uint8_t row;
  uint16_t rowPos;
};

struct Maps{
  WordMap Words;
  HourMap Hours;
  MinuteMap Minutes;
};

char het[] PROGMEM = "het";
Maps maps PROGMEM = { {het,    0,  0xe000}, {1, 3, 0xe000}, { 1,2,3 } };

To use in pgm_read_xxx, find the element you need then take its address. Say I want the row value from the WordMap:

Code:
x = pgm_read_byte( &maps.Words.row );

803  Using Arduino / Project Guidance / Re: EEPROM GUI development guidance on: December 23, 2013, 05:19:26 am
You write to the EEPROM while a sketch is running, I don't know of a program that can directly write the data ( it may well exist though ). You could either use a custom sketch to preset the data, or add in a one time function that will add the values if say an eeprom value is not set ( by the initial setup ).

If you like the hardware way, you could add a button to do a 'factory reset' which defaults the eeprom.

Here is some reading and a library that might help simplify access.
http://arduino.cc/en/Reference/EEPROM
http://playground.arduino.cc/Code/EEPROMWriteAnything

You can create a PC GUI to control the Arduino through the serial port ( or other comms ) using processing:
www.processing.org/

Any specific electrical questions can be directed to the General Electronics forum.
http://forum.arduino.cc/index.php?board=5.0
804  Using Arduino / Programming Questions / Re: strings / string literals on: December 22, 2013, 08:58:38 am
As you are using the print functionality you can avoid using the temporary buffer as the Print library can handle PROGMEM data.
It needs a little help, but still worth it if ram is tight.

Code:
//in file scope
#define PGMSTR __FlashStringHelper*

//In your code:
lcd.setCursor(0, j);
lcd.print( ( PGMSTR ) pgm_read_word(&menu_table[i]) );
805  Using Arduino / Programming Questions / Re: If Statement for my arduino mega + fingerprint sensor on: December 22, 2013, 05:46:20 am
You do not have a closing brace for your "void loop()". It needs to go before the function "getFingerprintEnroll".
806  Using Arduino / Programming Questions / Re: If Statement for my arduino mega + fingerprint sensor on: December 22, 2013, 05:31:07 am
You will need to post all of "void loop()" if you want us to have a crack at it ( error message says line 58  and 272, your code is cut short ).

But you have either left a semi colon off the end of a class declaration or you have not matched the number of open brackets '{' with closed ones.
807  Using Arduino / Programming Questions / Re: Ethernet header question on: December 22, 2013, 03:49:36 am
westfw is on the money, notice your IP addresses n ports mixed in there:

c0 a8 01 8c == 192.168.1.140
c0 a8 01 77 == 192.168.1.119
f2 30 == 62000
00 17 == 23
808  Using Arduino / Programming Questions / Re: Strange things happening when I try to use an array... on: December 18, 2013, 06:59:12 am
Here is a link to my BitBool class, it will handle storing/reading the bits as well as work just like a normal array: http://forum.arduino.cc/index.php?topic=128407.0
809  Using Arduino / Programming Questions / Re: Strange things happening when I try to use an array... on: December 18, 2013, 06:47:59 am
If the SD lib creates its buffer even when not used, then you are using a minimum of 1353 bytes with just the SD and array. If you use an Uno you may have swallowed all the RAM with the oled lib and such.
810  Using Arduino / Networking, Protocols, and Devices / Re: posted data not read by php script on: December 18, 2013, 01:45:02 am
No worries, hope I didn't wake you up with all the e-mails, I notice your profile says it would have been around 6am.
Pages: 1 ... 52 53 [54] 55 56 ... 150