I am glad, and it seems that you are making some progress (though I could understand if it does not feel like it yet). @jdaming 's code seems to be the answer to the LED. I will try it out when I get a chance and report back. @jdaming has helped me a lot lately and is incredibly brilliant in the ways of programming in FRC.
If his examples do not make sense, you may want to try using the Romi timed robot project template instead of the example. It is counter-intuitive, but starting from scratch really is easier for us in the beginning until we found a need to learn the command framework. You can even use CPP instead of Java if you are more familiar with that (though the abstraction is essentially the same save for the Command Framework).
I can see how this could all be a bit confusing coming from a lower-level programming background. I am coming at it from the other end, mostly. We were a Python team until I started looking for mini robots and did a self-directed crash course (literally) learning about how to create libraries and drive h-bridges from scratch. Then came the Romi and everything got a lot easier and clearer for both my team and me.
Anyway, my guess about the confusion would be all the levels of abstraction involved (as I understand them anyway).
We have in order from higher to lower-level…
- The command Framework (with the io subsystem)
- Wpilib simulator
- The web socket to the raspbery pi
- The wpilib Romi Interface on the Pi
- The I2C interface to the 32U4 control board
- The firmware.
- Then we get to our hardware.
To reverse this order, here is some documentation.
For Pololu’s interface, take a look here. <-- you may want to spend some time working with this directly if you have Arduino experience.
For the wpilib romi websocket interface, look here.
But of course, many people will jump right to the wpilib interface (I did) which has docs here.
The buttons, accelerometer, and Gyro are not really documented there, but the example program does work for the most part. to see what is happening there, you can look at the iosubsystem and look at the constructors of each of the items (you can call them directly in a timed robot project).
The Gyro specifically is confusing in the sense that it is a SimDevice(). So, whenever we use it, our team simply copies the entire class to our desired project and access it that way.
I think you will get the buttons and leds figured out, so I will jump right to the flexible DIO.
You can use the interface in the web portal described above to set it. Once done, you can use it to run many hardware devices (even h-bridges if you would like).
However, rangefinders are not so clear-cut. Many of them (especially LIDAR) use I2c. There does not seem to be a wpilib interface for this on the Romi (besides the one running the entire robot:). Even if you wrote your own, there is a danger of the device’s address being the same as the Romi, so you would need to be careful when picking out such a device.
Many others use a ping… …response DIO. I have not gotten these to work either. I can get the IO working independently, but something goes awry when I try to use the WPILIB interface.
Which leaves analog sensors. I have had a lot of success with these. There is one cheap model I have that came with a kit that does not work (I can dig it up if you are interested), but most of the generic ones and all of the Maxobotics we got through various kits over the years and through First Choice this year, work perfectly.
Sorry for the long post, or if I am off-base or inaccurate, but that is how I understand the Romi pieces currently.
Please, anyone, step in to correct me if I am.