All pastes #984030 Raw Edit

brent

public text v1 · immutable
·published 2008-04-13 21:10 UTC
rendered paste body
void loop() {
  int voice;
  int freq;
  // send data only when you receive data:
  
  
  if (Serial.available()) //there is a byte
  { 
      //is it the header?? 
    if (Serial.read() == 171) // ab hex
    {
       while(Serial.available() <= 1) //wait for two bytes
   {
   }
        voice = Serial.read();
        freq = Serial.read();
        // say what you got:

        Serial.print(voice);
        Serial.print("-");
        Serial.println(freq);
        
        write_pot(voice,freq);
        
    }else{
Serial.println("wrong header received flushing buffer");
      Serial.flush();
    }   
  }
}