Stap 4: Een snelle "Hello World" LED knipperen Test uitvoeren
In het BBB of RPi, ga naar de directory PyMata voorbeelden en pymata_blink.py open met je favoriete editor. Wijzig de bestaande code uit:
# Create a PyMata instance using the Arduino COM Port as the input parameter firmata = PyMata("/dev/ttyACM0")
Aan:
# Create a PyMata instance using the Arduino COM Port as the input parameter firmata = PyMata("/dev/rfcomm0")
En tot slot, om te beginnen het script, op de BBB en knipperen de LED op de Arduino, typ: python./pymata_blink.py
python ./pymata_blink.py PyMata version 1.58 Copyright(C) 2013-14 Alan Yorinks All rights reserved. <p>Opening Arduino Serial port /dev/rfcomm0 <br>Please wait while Arduino is being detected. This can take up to 30 seconds ... Board initialized in 0 seconds Total Number of Pins Detected = 20 Total Number of Analog Pins Detected = 6 Blinking LED 13 10 times 1 2 3 4 5 6 7 8 9 10 PyMata close(): Calling sys.exit(0): Hope to see you soon</p>
Er zijn enige tijd vertragingen betrokken, zo geduldig terwijl dit script wordt uitgevoerd. Na PyMata close() ziet u enkele uitzonderingen. Als u dit doet, kunnen dit worden genegeerd.