HELP how do i

i need to have all 5 numbers to display. however according to this code I only received the first number
from the left. how do I receive all the numbers? help is needed much appreciated!!

PARTIAL CODE:
int AP_alt_set[5];
int number=0;

if (Serial.available())
{
CodeIn = getChar();
if (CodeIn == '=')
{
EQUALS(); // The first identifier is "="
}

char getChar()// Get a character from the serial buffer
{
while(Serial.available() == 0); // wait for data
return((char)Serial.read());
}

void EQUALS()
{
CodeIn = getChar(); // Get another character
switch(CodeIn)
{
case 'b':
Count = 0;
Digit = "";
Digit += getChar(); // Makes the string Digit what ever getChar() is holding

number= Digit.toInt();
break;
}
}

the 'number' I received was only x. from a value of x0000
anyone help thanks!

The rules of the forum include the following

  1. POST ALL YOUR CODE

  2. DO IT IN CODE TAGS

Learn to read the instructions and documentation!

Mark

Here is your r code modified so it will compile.
I have added some comments so you need to comment them out so it will compile for you also.
( Save me so time and let's you code ).
Essentially if you put initial if (Serial.available()) inside loo() you should also code when there is no data in the serial buffer, at lest for your info.
In general checking the serial buffer using "if" is useful when you do not want the loop() to stop and wait for the data to be in the serial buffer.But than you should have code when the "if" is false.
When your app can wait for data to be in the serial buffer "while" construct will also work.

Good luck

char CodeIn; 
int Count = 0;
int Digit;
int number;

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
  // PARTIAL CODE:
  int AP_alt_set[5];
  int number = 0;
  if (Serial.available())
  {
    //process this when Serial.available() detects data in serial buffer 
    //getCahr waits for data , why? 
    CodeIn = getChar();

    nalyze data returned 
    if (CodeIn == '=')
    {
      EQUALS();              // The first identifier is "="
    }
  }
  continues loop when no data is in buffer OR after one byte is processed 
}

/* waits for data in serial buffer and when data is detected  reads single byte from serial buffer 
  
 */
char getChar()// Get a character from the serial buffer
{
  
  while (Serial.available() == 0);  // wait for data 
  return ((char)Serial.read());
}
void EQUALS()
{
  CodeIn = getChar();     // Get another character
  switch (CodeIn)
  {
    case 'b':
      Count = 0;
//      Digit = "";
      Digit += getChar();  // Makes the string Digit what ever getChar() is holding
//      number = Digit.toInt();
      break;
  }
}

Moderator edit: This is getting tedious Vaclav. Get a grip. Code tags corrected.

You may find the examples in Serial Input Basics useful. They are simple reliable ways to receive data.

...R

A very simple example of capturing a string of numeric characters sent from the serial monitor and converting them into an integer for use.

//zoomkat 7-30-10 serial servo test
//type servo position 0 to 180 in serial monitor
// Powering a servo from the arduino usually *DOES NOT WORK*.

String readString;
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

void setup() {
  Serial.begin(9600);
  myservo.attach(9);
  Serial.println("servo-test"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the String readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured String 
    int n = readString.toInt();  //convert readString into a number
    Serial.println(n); //so you can see the integer
    myservo.write(n);
    readString="";
  } 
}