robotpy / robotpy-wpilib

Moved to https://github.com/robotpy/mostrobotpy
https://robotpy.github.io
Other
169 stars 59 forks source link

Counter argumuent input #32

Closed computer-whisperer closed 9 years ago

computer-whisperer commented 9 years ago

When initializing a Counter object, it seems to be unable to accept just one channel for an argument. Attempting to do so results in a ValueError:

  File "/home/christian/PycharmProjects/modded-command/example.py", line 26, in <module>
    wpilib.RobotBase.main(MyRobot)
  File "/home/christian/robotpy-2015/lib/python3.4/site-packages/wpilib/robotbase.py", line 144, in main
    robot.startCompetition()
  File "/home/christian/robotpy-2015/lib/python3.4/site-packages/wpilib/iterativerobot.py", line 65, in startCompetition
    self.robotInit()
  File "/home/christian/PycharmProjects/modded-command/example.py", line 15, in robotInit
    self.counter = wpilib.Counter(1)
  File "/home/christian/robotpy-2015/lib/python3.4/site-packages/wpilib/counter.py", line 158, in __init__
    raise ValueError("didn't specify down source")
ValueError: didn't specify down source

Is this behavior intentional? If so, it seems odd for you to be unable to use the counter on a single port.

virtuald commented 9 years ago

Not sure. Check the java implementation to see. I'll look at this later tonight too.

computer-whisperer commented 9 years ago

The Java implementation does appear to allow just one channel argument https://github.com/frc1418/wpilib/blob/master/wpilibj/wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/Counter.java