using UnityEngine;
using System.Collections ;
using System.IO .Ports ;
using System;
public class RS232 : MonoBehaviour {
SerialPort sp = new SerialPort( "COM2" , 9600 ) ;
// Use this for initialization
void Start ( ) {
// sp = new SerialPort("COM10", 9600);
sp.ReadTimeout = 100 ;
sp.Open ( ) ;
}
// Update is called once per frame
void Update ( ) {
try{
print ( sp.ReadLine ( ) ) ;
} catch( Exception e) { } ;
}
}
dXNpbmcgVW5pdHlFbmdpbmU7CnVzaW5nIFN5c3RlbS5Db2xsZWN0aW9uczsKdXNpbmcgU3lzdGVtLklPLlBvcnRzOwp1c2luZyBTeXN0ZW07CgpwdWJsaWMgY2xhc3MgUlMyMzIgOiBNb25vQmVoYXZpb3VyIHsKCglTZXJpYWxQb3J0IHNwID0gbmV3IFNlcmlhbFBvcnQoIkNPTTIiLCA5NjAwKTsKCgkvLyBVc2UgdGhpcyBmb3IgaW5pdGlhbGl6YXRpb24KCXZvaWQgU3RhcnQgKCkgewovLwkJc3AgPSBuZXcgU2VyaWFsUG9ydCgiQ09NMTAiLCA5NjAwKTsKCQlzcC5SZWFkVGltZW91dD0xMDA7CgkJc3AuT3BlbigpOwoJfQoJCgkvLyBVcGRhdGUgaXMgY2FsbGVkIG9uY2UgcGVyIGZyYW1lCgl2b2lkIFVwZGF0ZSAoKSB7CgkJdHJ5ewoJCQlwcmludCAoc3AuUmVhZExpbmUoKSk7CgkJfWNhdGNoKEV4Y2VwdGlvbiBlKXt9OwoJfQp9Cg==
compilation info
prog.cs(1,7): error CS0246: The type or namespace name `UnityEngine' could not be found. Are you missing a using directive or an assembly reference?
Compilation failed: 1 error(s), 0 warnings
stdout