theycallmeswift / breakfastserial Goto Github PK
View Code? Open in Web Editor NEWA Firmata based framework for interacting with Arduinos over serial.
License: MIT License
A Firmata based framework for interacting with Arduinos over serial.
License: MIT License
Worked with @kymwatts to figure out bluetooth serial communication yesterday. Need to document how to get it all working so others can use it.
Windows is actually already supported if you specify the COM port manually:
board = Arduino("COM5")
Adding windows support should be as simple as adjusting the regex to match open COM ports as well.
Also need to update the documentation.
I am getting the following error when I try to compile the file:
python led.py
Traceback (most recent call last):
File "led.py", line 7, in <module>
from BreakfastSerial import Led, Arduino
File "/Users/.../anaconda/lib/python3.6/site-packages/BreakfastSerial/__init__.py", line 5, in <module>
from components import *
ModuleNotFoundError: No module named 'components'
Any idea what the problem is?
The RGB LED that came with my arduino kit is reverse polarity; that is, the common lead is actually Vcc and the individual color inputs have to be pulled LOW to turn on. I don't know if I have a weirdo defective LED or if this is a common thing.
If it's the latter, it'd be nice if we had a switch to reverse the polarity of the RGBLed object so that it pulled the pins lower to make colors brighter for LEDs configured that way.
Getting this once in a while. Looks like a pyFirmata issue.
Connecting to /dev/cu.usbmodem1411
Traceback (most recent call last):
File "motor.py", line 10, in <module>
board = Arduino()
File "/Users/theycallmeswift/dev/open-source/BreakfastSerial/BreakfastSerial/BreakfastSerial.py", line 28, in __init__
super(Arduino, self).__init__(*newargs)
File "/Users/theycallmeswift/dev/open-source/BreakfastSerial/venv/lib/python2.7/site-packages/pyfirmata/__init__.py", line 16, in __init__
super(Arduino, self).__init__(*args, **kwargs)
File "/Users/theycallmeswift/dev/open-source/BreakfastSerial/venv/lib/python2.7/site-packages/pyfirmata/pyfirmata.py", line 87, in __init__
self.iterate()
File "/Users/theycallmeswift/dev/open-source/BreakfastSerial/venv/lib/python2.7/site-packages/pyfirmata/pyfirmata.py", line 266, in iterate
handler(*received_data)
File "/Users/theycallmeswift/dev/open-source/BreakfastSerial/venv/lib/python2.7/site-packages/pyfirmata/pyfirmata.py", line 152, in decorator
f(*args, **kwargs)
TypeError: _handle_report_version() takes exactly 3 arguments (45 given)
I have problems with using the Sensor .value returning a NoneType. I can't perform any math on it.
Create a component for DC motor and document it.
This is the script I'm using to test BreakfastSerial
from BreakfastSerial import Arduino, Servo
from time import sleep
board = Arduino()
servo = Servo(board, 10)
import code
code.InteractiveConsole(locals=globals()).interact()
When running this on an Ubuntu Virtual Machine, it works fine. When running this with Raspberry Pi, this consistently happens:
First run (tries to connect to ttyACM0):
python servo_test.py
Connecting to /dev/ttyACM0
Python 2.7.3 (default, Jan 13 2013, 11:20:46)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/usr/local/lib/python2.7/dist-packages/BreakfastSerial/BreakfastSerial.py", line 80, in run
while self.board.bytes_available():
File "/usr/local/lib/python2.7/dist-packages/pyfirmata/pyfirmata.py", line 225, in bytes_available
return self.sp.inWaiting()
File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 435, in inWaiting
s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)
IOError: [Errno 5] Input/output errorexit()
Second run (Tries to connect to ttyACM1):
python servo_test.py
Connecting to /dev/ttyACM1
Python 2.7.3 (default, Jan 13 2013, 11:20:46)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
servo.center() #This call worked properly before the exception below
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/usr/local/lib/python2.7/dist-packages/BreakfastSerial/BreakfastSerial.py", line 80, in run
while self.board.bytes_available():
File "/usr/local/lib/python2.7/dist-packages/pyfirmata/pyfirmata.py", line 225, in bytes_available
return self.sp.inWaiting()
File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 435, in inWaiting
s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)
IOError: [Errno 5] Input/output error
exit()
Every subsequent run(tries connecting to ttyACM0)
python servo_test.py
Connecting to /dev/ttyACM0
Traceback (most recent call last):
File "servo_test.py", line 5, in
board = Arduino()
File "/usr/local/lib/python2.7/dist-packages/BreakfastSerial/BreakfastSerial.py", line 31, in init
raise FirmataNotOnBoardException
BreakfastSerial.BreakfastSerial.FirmataNotOnBoardException
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.