Language \ Environment \ Comparison
 
Index
 
  The Processing 1.0 _ALPHA_ Reference is a work in progress.
If you see any errors or have any comments, please write to: reas at groupc.net
Name  

serialEvent()

   
Examples  
int val; 
 
void setup() { 
  beginSerial(); 
} 
 
void loop() { 
  // Set the background to the value in val 
  background(val);  
} 
 
// Called every time there is data available to read 
void serialEvent() {  
  // Initializes the variable val with the 
  // last value readed by the serial port 
  val = serial;	      
} 
 

Description   The serialEvent() function is called when there is new data available to read. This simple function assumes that only one byte will be read at a time.
   
Syntax  
serialEvent()
   
Parameters  
 

   
Returns   None
   
Usage   Application
   
Related   beginSerial()
endSerial()
serialWrite()
serial
   
© 2004 - 2001 Massachusetts Institute of Technology and Interaction Design Institute Ivrea
Processing is an open project initiated by Ben Fry and Casey Reas