Index
 
  The Wiring 1.0 _ALPHA_ Reference is a work in progress.
If you see any errors or have any comments, please write to: hbarragan [at] uniandes.edu.co
Name  

read()

   
Examples  
int val; 
 
void setup() { 
  Serial1.begin(9600); 
} 
 
void loop() { 
  // Set the analog output pin 0 to the value in val 
  if(Serial1.available() > 0) { 
    val = Serial1.read(); 
  } 
  analogWrite(0, val);  
} 
 
 

Description   Returns a number between 0 and 255 for the next byte that's waiting in the buffer. Returns -1 if there is no byte, although this should be avoided by first checking available() to see if data is available.
   
Syntax  
serial.read()
   
Parameters  
serial   The serial port, it can be Serial or Serial1

   
Returns   int
   
Usage   Application