Hi ! I have some problems to poll analog pins

Before I used :

right.addListener("publishPin", "python", "publishPin")

def publishPin(pin):
  print pin.pin, pin.value

analogReadPollingStart no worky anymore


So I try that :

def publishPin(pin):
  print pin.value

right.addListener("publishPin", "python", "publishPin")    

no worky


def onPin(value):
    print value
right.addListener("onPin", "python", "onPin")    

but no lucky I am :)


6 years 1 month ago

maybe there is a better way, but this work

arduino = Runtime.createAndStart("arduino","Arduino")
def publishPin(pins):
    for pin in range(0, len(pins)):
        print pins[pin].address, pins[pin].value
#arduino.enablePin(pinAddress, rate)
#analog pin range are 14-18 on uno, 54-70 on mega
#rate is the number of polling / sec
arduino.enablePin(15, 1)

add on

the enablePin(pinAddress, rate) have been implemented recently and is available on the latest build

enablePin(pinAddress) will be available on Kraken (latest stable)


6 years 1 month ago

In reply to by calamity

Hi !! Thank you for your awnser. It's better but . mmm. :

I use 1744

right.enablePin(54) ok

right.enablePin(54,1) nok ( error no such method ) I think i have not the last one no problem.

But with right.enablePin(54) I have 1 time on 2 a lot of buffer overrun and finaly crash mrl

22:17:28.967 [python_outbox_0] WARN  org.myrobotlab.framework.Inbox - GUIService inbox BUFFER OVERRUN dumping msg size 1025 - getStdOut

this is my script

right=Runtime.create("i01.right", "Arduino")
right = Runtime.start("i01.right", "Arduino")
def publishPin(pins):
    for pin in range(0, len(pins)):
        print pins[pin].address, pins[pin].value

Hi Moz4r

I have recheck enablePin(54,1) and it's working for me, not sure why it's not working for you

I also have problem with just enablePin(54) work well a some random time, then the hells of message errors happen. Look like the optimization we have done on MRLComm is so good the the MRL java messaging can't keep up.

That's why I implement last week-end the alternative method with the rate setting.


found the problem, look like my last changes to MRLComm did not found their way to github so the version on my arduino was different than the one with MRL

fixed on v1745, upload the MRLComm to have the fix, I did not change MRLComm version number

sorry  about that and thanks for helping to debug


It works great !! 

Is it possible to tweak the timer because I use hall effect sensors and data are not accuracy enough ( the signal is not straigh. The sensors send interesting data, only few micro seconds and I need to be lucky to read it every 1 second.


Nice moz4r

Happy that you get it working

If I understand, the sensor you are testing are detecting if something was put in the hand?

what kind of sensor did you use?