我在这里有代码
import Adafruit_PCA9685
pwm = Adafruit_PCA9685.PCA9685()
pwm.set_pwm_freq(60)
# Demo using LED on Channel 12 of the PCA9685
# Wire up the LED on Channel 12 such that
# Shortleg of LED goes to GND and
# Long leg goes to PWM pin on channel 12
pwm.set_pwm(12,0,4095) # Full bright
time.sleep(5)
pwm.set_pwm(12,1024,3072) # half bright
time.sleep(5)
pwm.set_pwm(12,0,0) #off
time.sleep(5)
输出如图所示:
如何获得这样的图形:
答案 0 :(得分:1)
不使用Python,我只有一个纯粹的graphviz
答案,但是您应该可以轻松地将其翻译成Python。
您需要做两件事:
rank = same
指令中(在示例上下文中并非严格必要,但对于更复杂的图形可能是必需的)我们在这里:
digraph so
{
n_1[ label = "a" ];
n_2[ label = "b" ];
n_3[ label = "c" ];
n_4[ label = "c" ];
{ rank = same; n_2 n_3 }
n_1 -> { n_2 n_3 };
n_2 -> n_4;
}
给你