Learning how to do things w/out functions REQ.

I'm pretty new to Arduino, but i have a large background in programming.

I'm wondering how i can do a certain thing without using certain functions:

Basically I have a windows program that sends settings to arduino which changes LCD brightness, text etc.

Well normally how i would do it is to send something like:

LCD|B|255 to change LCD brightness...
or
LCD|C|TEXT|the text to write to LCD

and then have a switch statement within arduino to split those values, however arduino is lacking some of those types of functions thus making this more difficult, what makes it worse is im using atmega186 so i am limited on what resources i can use.

Any help would be appreciated!

Regards,
Jason :o

What do you have working? Do you have code written that collects characters into strings?

Well i only have the commuication between arduino and my PC working, however i'm not really sure how i can send the arduino a command and then a variable to perform an action on so for instance i want tell arduino to make the LCD brightness set to 190 i would send those settings from a program on my computer (which i have written already) and then arduino would see the command and make it happen. However without string manipulation on arduino's end im not sure how to accomplish this.

For instance i want to make the screen 190 brightness i would send
lcd+190
OR
wrt+write this to screen

or something, and arduinos end i would be looking for the commands to perform because there will be more than one command so i would need some kind of function to perform this, but im to new so im not figuring it out, i do know that arduino is limited in functions... so thats why im lost..

Regards
Jason

Hi,

take a look here:

But by the way, the arduino is a microcontroller with limited ressources. So it is always a good idea to use simple protocols. Why not use LB255 instead of LCD|B|255? The first character can specify the device, the second one the function/operationand the rest the value(s). Then you can very easy operate with switch statements:

if (Serial.available()) {
  c = Serial.read();
  switch (c) {
  case 'L':
  case 'l': // Device is LCD
              if (Serial.available()) {
                c = Serial.read();
                switch(c) {
                case 'B':
                case 'b': //brightness
                             ...

It is also always a good idea to preceed every command with a start character, which is unique, for example a STX (0x02). This makes it possible to recognize the start of a new command if the serial line is disturbed and the arduino is missing characters.

good luck
Mike