I am new to python and working with firmata, I am trying to play with arduin.
Here is what I want:
- Set arduino with LED as digital output
Set potentiometer to analog 0
Set PyQt timer to update potentiometer position in
application
Set the threshold value in PyQt to turn the LED on (the analog input has 1024 bit resolution, so to say 800 as a threshold value)
I use this firmata library: Link
Here is the code I'm having problems with:
import sys from PyQt4 import QtCore, QtGui from firmata import *
self.a = Arduino('COM3')
self.a.pin_mode(13, firmata.OUTPUT)
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 get an error message:
Traceback ( ): "D:\Programming\Eclipse\IO Demo\src\control.py" , 138, myapp = MainWindow() "D:\Programming\Eclipse\IO Demo\src\control.py" , 56, init self.appTimer.event(self.updateAppTimer()) "D:\Programming\Eclipse\IO Demo\src\control.py" , 60, updateAppTimer self.analogPosition = self.a.analog_read (self, 0) TypeError: analog_read() 2 (3 )
"self", , 1
python, ?
Blockquote