有问题指教:
入坑虚拟工厂项目,VS编译没提升错误,单无法进入Play模式。
代码如下:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using HslCommunication;
using HslCommunication.Profinet.Siemens;
public class MainMotorTurn : MonoBehaviour
{
SiemensS7Net siemens;
// Start is called before the first frame update
void Start()
{
siemens = new SiemensS7Net(SiemensPLCS.S300,"10.2.31.36");
}
// Update is called once per frame
void Update()
{
this.transform.Rotate(Vector3.forward*GetSpeed());
}
int GetSpeed()
{
OperateResult read =siemens.ReadInt16("DB99,78");
double speed = 0;
if (read.IsSuccess)
{
// you get the right value
speed = read.Content;
}
else
{
speed = 0;
// failed , but you still can know the failed detail
//Consolo.WriteLine(read.Message);
}
// when you don't want read data, you should call close method
//siemens.ConnectClose();
return (int)speed;
}
}