哪些 unicode 字符最适合在字符串中绘制方波

gjw*_*jwo 5 java raspberry-pi

我试图通过存储的 GPIO 事件和时序数组来表示字符串中的方波脉冲序列。代码正在运行,但我需要更好的 Unicode 字符进行转换。

这是我目前的方法

    public String waveform()
    {
    String s = "";
    int pulses;
    int pulseWidth;

    pulseWidth = events.get(1).duration; //mostly right!
    for (RF433Event e: events)
    {
        pulses = e.duration/pulseWidth;
        if (e.gpioEvent.getEdge() == PinEdge.RISING)
        {
            // rising edge so for the duration it was low
            for (int i = 0; i<pulses; i++) s = s+'_';
            s = s+"\u02E9";
        } else
        {
            // falling edge so for the duration it was high
            for (int i = 0; i<pulses; i++) s = s+"\u0305";
            s = s+"\u02E5";
        }

    }
    return s;
    }
Run Code Online (Sandbox Code Playgroud)

Intellij 控制台窗口中的输出如下所示 在此输入图像描述

但奇怪的是没有出现在 RPi 上,我需要在 Pi 上安装其他东西吗?

gjw*_*jwo 7

经过多次实验,这对我有用

public String waveform()
{
    String s = "";
    int pulses;
    int pulseWidth;
    // Characters tried for drawing the pulse train
    // Low line - "_", "\u0332" Combining Low Line, "\uFF3F"; FULLWIDTH LOW LINE
    // High line - "\u0305" COMBINING OVERLINE, "\u203E" over line 
    // Vertical -  "\u20D2" COMBINING LONG VERTICAL LINE OVERLAY, "\u007C" Vertical line, "\u02E9" MODIFIER LETTER EXTRA-LOW TONE BAR
    if (events.get(0).duration > 50000) {return "Excessive duration in pluse 0 "+events.get(0).duration;}
    pulseWidth = 100; //gives a reasonable pulse train
    for (RF433Event e: events)
    {
        pulses = e.duration/pulseWidth;
        if (e.gpioEvent.getEdge() == PinEdge.RISING)
        {
            // rising edge so for the duration it was low
            for (int i = 0; i<pulses; i++) s = s+ "_";
            s = s+"\u20D2";
        } else
        {
            // falling edge so for the duration it was high
            for (int i = 0; i<pulses; i++) s = s+"\u0305";
            s = s+"\u20D2";
        }
    }
    return s;
}
Run Code Online (Sandbox Code Playgroud)

这些是结果 脉冲序列