noob needs help oncode to read an odd input

I need to read an input into 3 different varriables or states.
the first input will be something like 101010, 100100100, or 110110110. i need to read it as something preferably bianary give it a name like 'blink"
the second, and third inputs will be 0000000, or 1111111. both needing different names like "high, low"
the trick is they are all on the same pin it will give one of the 3 at different times. either on off or blink

how in the world can i code that?
an average of the numbers, and separate case for each 1, 0, or a fraction?
a mode or most often in a set of numbers?
would something like that work would it be acurate? if so how do you code it.

It might be simpler just to post a link to your homework assignment. Then we could read that.

it is to read a stop/ blink light on a car so i can have things happen when i stop, turn, etc. i havent learned anything this advanced in school thats the problem it is just a project.

Try loading up some of the example programs that came with the Arduino, and solve your first problem ... reading an input. Then try blinking an LED. Then get back to us if you have trouble combining them. But post what you have done so far.

I can read an input. i can set an output. when i read a pin in this case i get a HIGH or a LOW useing a digital read. i can tell what the input is doing at any givin time.
what i need is some help in how to store some variable based on what the input WAS recently so if the past few reads are something i can convert that to 3ish differnt values stored separatly

well lets start with that:
how do you store and compare multiple digital reads (or for 3 states on one pin would analog be better?)

You would need to note the state change (ie, when the input changes and goes high, not when it is high). Then you just count how many times it goes high in a certain time frame (say 2 seconds). If it goes high more than once, then you know it is blinking.

Look at the example StateChangeDetection.
Also, for your timing, you have to be proficient in the Blink Without Delay.

thanks will do

ok here is what i have got i modified statechangedetection.
how could i add a tolerence to this code:

// counts 20, also counts high, and low counts so high and low always add to 20

if(highCount == count){      // it doesnt have to be exactly count could be count- 2 can i do that?
    digitalWrite(brakePin, HIGH);
    digitalWrite(wavePin, LOW);
  if (highCount == lowCount){       // just needs to be close to equal 
    digitalWrite (wavePin, HIGH);
    digitalWrite(brakePin, LOW);
  if (lowCount = count){             // this is like the 1st  the tolerance for the 3 cant overlap though.
    digitalWrite(brakePin, LOW);
    digitalWrite(wavePin, LOW);

here is the full code: How do you post code BTW? hey thanks

  State change detection (edge detection)
 Often, you don't need to know the state of a digital input all the time,
 but you just need to know when the input changes from one state to another.
 For example, you want to know when a button goes from OFF to ON.  This is called
 state change detection, or edge detection.
 This example shows how to detect when a button or button changes from off to on
 and on to off.
 The circuit:
 * changeing signal attached to pin 2
 * LED sets attached on wavePin,, and brakePin
 * LED attached from pin 13 to ground (or use the built-in LED on
   most Arduino boards)
 created  8 march 2012
 modified 8 march 2012
 by Brad Nelson

This code is based on the public domain code buttonStateChange

// this constant won't change:
const int  signalPin = 2;    // the pin that the pushbutton is attached to
const int ledPin = 13;       // the pin that the LED is attached to
const int brakePin = 3;
const int wavePin = 4;

// Variables will change:
int signalState = 0;         // current state of the button
int lastSignalState = 0;     // previous state of the button
int highCount = 0;
int lowCount = 0;
int interval = 20;
int count = 0;

void setup() {
  // initialize the button pin as a input:
  pinMode(signalPin, INPUT);
  // initialize the LED as an output:
  pinMode(ledPin, OUTPUT);
  pinMode(brakePin, OUTPUT);
  pinMode(wavePin, OUTPUT);

void loop() {
  // read the pushbutton input pin:
while(count < interval){
  signalState = digitalRead(signalPin);
  // compare the buttonState to its previous state
  if (signalState != lastSignalState) {
    // if the state has changed, increment the counter
    if (signalState == HIGH) {
      // if the current state is HIGH then the button
      // wend from off to on:
    else {
      // if the current state is LOW then the button
      // went from on to off:
  // save the current state as the last state, 
  //for next time through the loop
  lastSignalState = signalState;
  if(highCount >= count){
    digitalWrite(brakePin, HIGH);
    digitalWrite(wavePin, LOW);
  if (highCount == lowCount){ 
    digitalWrite (wavePin, HIGH);
    digitalWrite(brakePin, LOW);
  if (lowCount >= count){
    digitalWrite(brakePin, LOW);
    digitalWrite(wavePin, LOW);  

How do you post code BTW?

Edit your post. Select the code. Hit the "#" button above the input box to put it into "code" tags.

  if (lowCount = count){

Bzzzzt. Wrong.