Hello. I am pretty new to python and working with firmata I am trying to play around with an arduino .
Here is what I want to happen:
- Set arduino up with an LED as a digital out
Set potentiometer to analog 0
Set PyQt timer up to update potentiometer position in
applicationSet a threshold in PyQt to turn LED on (Analog in has 1024bit resolution, so say 800 as the
threshold)
I am using this firmata library : Link
Here is the code that I am having trouble with:
import sys from PyQt4 import QtCore, QtGui from firmata import *
# Arduino setup
self.a = Arduino('COM3')
self.a.pin_mode(13, firmata.OUTPUT)
# Create timer
self.appTimer = QtCore.QTimer(self)
self.appTimer.start(100)
self.appTimer.event(self.updateAppTimer())
def updateAppTimer(self):
self.analogPosition = self.a.analog_read(self, 0)
self.ui.lblPositionValue.setNum()
I am getting the error message:
Traceback (most recent call last): File "D:\Programming\Eclipse\IO Demo\src\control.py", line 138, in myapp = MainWindow() File "D:\Programming\Eclipse\IO Demo\src\control.py", line 56, in init self.appTimer.event(self.updateAppTimer()) File "D:\Programming\Eclipse\IO Demo\src\control.py", line 60, in updateAppTimer self.analogPosition = self.a.analog_read(self, 0) TypeError: analog_read() takes exactly 2 arguments (3 given)
If I take 'self' out I get the same error message but that only 1 argument is given
What is python doing implicitly that I am not aware of?
Blockquote