I apologize for the strange title, I couldn't think of a better description.
Basically I have this sketch with several int variables. I'm interfacing my mac through a Cocoa app that simply sends keyboard commands through the serial monitor when a button is pressed. In the switch statement the "incomingbyte" value sends the corresponding pre-declared int variable. If the switch statement grows beyond 4 cases the serial monitor gets funny. It'll only display an "!", which is the last character in "Ready!" the default case. I'm accompanying each case with a "serial.println" for debugging purposes.
If it helps you to know what I'm (attempting/)doing, I'm controlling a TV with a Cocoa "remote control".
Like I said, the serial monitor gets funny after 4 cases, and sometimes it won't open at all and begins crashing the IDE and Java.
Is there a better way to handle the input from the app? Also, how can I store the variables in a separate file? I'd like to clean up the main sketch a bit by placing all those unsigned int variables in a separate location.
I'm using a duemilanove ATmega 168
Here's the code;
www.cuttlesoft.com/arduino/irSendCocoa_v2.zip
I've included Ken Shiriff's amazing IRSend library as the sketch will not compile without it.
Any time you add code that has strings (and Serial.print()) that starts to point to RAM exhaustion.
I'm using a duemilanove ATmega 168
The ATmega168 has 1k of SRAM.
You have declared 23 integer arrays with 68 elements each. 68*23 = 1564 bytes.... You've run out of RAM before the sketch even starts. Also, each string used in a serial.print() consumes RAM as well.
You probably need to look at using PROGMEM.
It's so obvious it hurt to read
Since I'm utilizing the computer as the interface I should lean as much on it's memory and speed as possible. So now I'm assuming I can store the int arrays in the cocoa app and then pass them through the serial monitor instead. Can I parse them or set a single variable to the intended int array when a button is pressed?
I don't understand what you are saying/asking.
If the arrays don't change, put them in PROGMEM instead of RAM. Probably easier than passing back and forth over serial.
As I found out very quickly! I tried using PROGMEM, it compiled and uploaded without errors and the serial monitor is now behaving correctly. However, the ir is not being sent. I'm guessing it's a syntax error on my part declaring the variables to PROGMEM. I will keep trying. Thanks so much for your help so far.