zoukankan      html  css  js  c++  java
  • 一段判断电子秤的负重的逻辑代码

     public static string strWeight = "";
    
            private void weight()
            {
                while (true)
                {
                    Thread.Sleep(10);
                    double s3 = 0.0;
                    string s223 = paras.parameter.weight;
                    if (s223 == null)
                    {
                        continue;
                    }
                    //else
                    //{
                    //    s3 = getWeight(s223);
                    //}
                    if (s3 < 0.018)
                    {
                        strWeight = "";
                    }
    
                    double dd = 0.0;
                    int iTime = 0;
                    while (true)
                    {
                        Thread.Sleep(10);
                        iTime++;
                        if (iTime > 500)
                        {
                            CodeString2 = "";
                            break;
                        }
    
                        if (dd > 0.01)
                        {
                            Thread.Sleep(180);
                            s223 = paras.parameter.weight;
                            s3 = getWeight(s223);
                            if (Math.Abs(s3 - dd) < 0.01)
                            {
                                //Thread.Sleep(100);
                                //s223 = paras.parameter.weight;
                                //s3 = getWeight(s223);
                                //if (Math.Abs(s3 - dd) < 0.02)
                                {
                                    dd = s3;
                                    break;
                                }
                                dd = s3;
                            }
                            dd = s3;
                        }
                        else
                        {
                            s223 = paras.parameter.weight;
                            dd = getWeight(s223);
                        }
    
    
                        //s222 = 0.06.ToString();
                    }
    
                    strWeight = dd.ToString();
                    //tbx_weight.Text = strWeight;
                    //tbx_weight .Refresh();
                }
            }
    

     

    注:本篇随笔无甚意义,当时为了摸索博客园怎么用随便写的,如果说它有什么意义,那就是它较准确地记录了我开博的起始时间。

    作者:xh6300

    --------------------------------------------

    本文系原创作品,转载请注明出处。如果您认为文章对您有帮助,可以点击下方的【好文要顶】或【关注我】;如果您想进一步表示感谢,可以通过网页右侧的【打赏】功能对我进行打赏。感谢您的支持,我会继续写出更多对大家有帮助的文章!文章有不理解的地方欢迎跟帖交流,博主经常在线!^_^

  • 相关阅读:
    Shell 学习笔记之函数
    Shell 学习笔记之条件语句
    Shell 学习笔记之运算符
    Shell 学习笔记之变量
    [LeetCode] Zuma Game 题解
    [LeetCode] Decode String 题解
    [LeetCode] Pacific Atlantic Water Flow 题解
    TCP的建立和终止 图解
    [LeetCode] 01 Matrix 题解
    java中protect属性用法总结
  • 原文地址:https://www.cnblogs.com/xh6300/p/5728003.html
Copyright © 2011-2022 走看看