小编Ame*_*ena的帖子

将十六进制代码发送到串行端口

我正在使用posiflex客户显示器,我正在尝试清除显示器.我已经阅读了用户手册,我找到了PST命令模式,它使用十六进制代码.我不知道如何将这些十六进制代码传递给串口来清除我的显示器.从手册中,我需要发送以下十六进制数字: 14 0E

我尝试使用以下代码发送这些字节,但我不知道如何同时传递两个字节.

SerialPort sp = new SerialPort();

    sp.PortName = "COM6";
    sp.BaudRate = 9600;
    sp.Parity = Parity.None;
    sp.DataBits = 8;
    sp.StopBits = StopBits.One;
    sp.Open();
   byte[] bytestosend = new byte[1] { 0x0E };

    sp.Write(bytestosend, 0, 1);
    sp.Close();
    sp.Dispose();
    sp = null;
Run Code Online (Sandbox Code Playgroud)

当我使用此代码时,不执行任何操作(不清除显示).

c#

3
推荐指数
1
解决办法
2万
查看次数

错误:变量是只读的。反应本机错误

我正在尝试为我的应用程序创建 backgroundcarousel。我正进入(状态

“DEVICE_WIDTH”是只读的

当我删除它并添加一些值时,它没有错误,但无法按预期工作。

const DEVICE_WIDTH = Dimensions.get("window").width;

componentDidMount = () =>{
    setInterval(() => {
        this.setState(
            prev => ({ selectedIndex: prev.selectedIndex === this.props.images.length - 1 ? 0 : prev.selectedIndex + 1 }),
            () => {
                this.scrollRef.current.scrollTo({
                    animated: true,
                    y: 0,
                    x: DEVICE_WIDTH = this.state.selectedIndex  //error here
                });
            }
        );
    },2000);
}
Run Code Online (Sandbox Code Playgroud)

javascript slider react-native

0
推荐指数
1
解决办法
481
查看次数

标签 统计

c# ×1

javascript ×1

react-native ×1

slider ×1