VEXCode Robot Config vs 3 wire ports

After updating to vex code 1.0.0 a week or so ago my code decided that it would function a bit differently and now give me memory permission errors.

One eternity later we found that our 3 wire device declarations was causing the errors. We went through the process of putting the devices into the graphical robot config and the robot started working again. Still unsure what was wrong with my version I copied the auto-generated code and pasted it in with the rest of my declarations (note that the motors are not having this issue) and the error came up again.

The config is literally at the top of my file right underneath the global instance of ‘competition’ in the competition template. Only the three wire config is causing an error - that makes no sense to me.

Today I updated to 1.0.1 so I could paste the config directly into robot-config.cpp, but I get errors in main.cpp because my devices are undeclared there. I’m sure there’s a solution to that but at this point I’m in above my head and I don’t see why I can’t just leave the declarations in main.cpp.

Make sure that you have included robot config file in main.cpp would be the one thing I can think of off the top of my head.
There isn’t a reason (as far as I’m aware) that you shouldn’t be able to just have definitions in main.cpp

You cannot use Brain.ThreeWirePort before the various Brain constructors are called. The order that constructors are called is indeterminate across files. The best way to deal with this is to create an instance of triport in main.cpp if you want to create instances of devices that need access to three wire ports.

1 Like