Hi,
Today's problem of the day is the SmartDashboard. I am using this [summarized] code on the robot:
Code:
def robotInit(self):
self.sensor = wpilib.AnalogInput(3)
wpilib.SmartDashboard.putNumber("Clicky1", self.sensor.getValue())
def teleopPeriodic(self):
wpilib.SmartDashboard.putNumber("Clicky1", self.sensor.getValue())
and this code on our driver station computer:
Code:
from networktables import NetworkTable
NetworkTable.setIPAddress("roborio-4480-frc.local")
NetworkTable.setClientMode()
NetworkTable.initialize()
sd - NetworkTable.getTable("SmartDashboard")
while True:
try:
print('distance:', sd.getNumber('Clicky1'))
except KeyError:
print('distance: N/A')
So I get a KeyError for when it tries to pull "Clicky1". Am I supposed to put more code on the robot to define the Clicky1 name? Or is there a way to make sure I am connected for sure to the robot? Sorry for all the questions.