0

I have my Arduino hooked up via serial to my computer and can do basic digital writes and stuff to the Arduino with Python (using the pyfirmata library). So what I'd like to know is whether or not I can make use of gyroscopes and accelerometers with pyfirmata?

4

1 回答 1

0

是的你可以。

我对 pyfirmata 了解不多,但它看起来像是基于 pyserial。我在过去使用了一点。我会告诉你我对pyserial的了解

在阿杜诺

void setup() {
 // open the serial port at 9600 bps:
 Serial.begin(9600);
 }

在 PC python 终端上

>>> ser = serial.Serial()
>>> ser.baudrate = 9600         <--same as the arduino void setup()
>>> ser.port = 0                <--Name of the virtual com port
>>> ser.open

当您从一个写入时,您可以从另一个读取。

http://arduino.cc/en/Reference/Serial http://pyserial.sourceforge.net/shortintro.html

于 2013-05-21T15:59:24.610 回答