Greetings! I’m rather verbose in most communications because I believe background knowledge is important.
I am well versed in Matlab.
I have a Cerberus with 2 button modules, a 16x2 Character display, 5 breakout boards, a relay module, a battery pack module
I will eventually have a 0-100 psig pressure transducer that’s powered via 5 volts and outputs 0.5 to 4.5 volts, a solenoid valve that operates on AA cells powered through the relay
Overall Purpose of Program
What I’m currently doing to learn C#
What I’ve figured out so far
A specific problem I’m having related to using a button module
The overall purpose of the program is to surface a “breath hold diver” if they either A. Descend deeper than the pressure source will support, B. Fail to resurface after a predetermined time.
I want to use a button to cycle through options to choose a pressure status of the bottle and the other button to confirm the selection.
Then I want to use the same button to cycle through another set of options, again with the other button to confirm the selection.
After that, I want to start a timer once the pressure transducer senses that the breath hold diver has descended. I want to be able to interrupt this timer and add to it while the diver is under water (until a maximum time.)
If the diver does not surface within the prescribed time, the solenoid valve actuates via the relay to inflate the pressure bladder.
If the diver does surface before the timer goes off, I want the timer count to be suspended.
I then want to give the diver the option to keep the current settings or change them. This whole idea needs to be able to loop.
- So far I’ve read all the beginners guides I could find on here and adapted Joystick/LED tutorial for my buttons, relay and character display.
I also bought a book, which is driving me a little crazy since it’s oriented towards app development. It’s still good though.
I watch about 4 hours of C# 101 by 3dbuzz.com.
I’ve been trying to find things that I can understand in the codeshare but a good portion of it is confusing. I understand all the ideas behind the programming and whatnot, the syntax simply eludes me.
- I can work my character display to say whatever I want triggered by a button press.
I can work my relay to turn on and off for whatever time period I desire triggered by a button press and not by a button press.
I made a while loop that acts as a timer by putting the thread to sleep and displaying the time elapsed/remaining using integer values that count each loop and I’ve integrated them to print to the character display.
I was able to glean a piece of code from some other forum question to be able to read the voltage of pin 20 from the cerberus board except I had to do it by using the breakoutboard and specifying pin 3 (it already figured out what socket it was using.) I found out by crashing the code that this value needs to be disposed of or things go haywire.
- I want to use the button press outside of the method “void programstarted()” but it won’t recognize the command as being valid anywhere but in “void programstarted().” Essentially, I want to make what the button does change based on what class I’m in.
TL;DR, please give me some advice on how I might speed along my learning process. I feel like the button method only being available within the “void programstarted()” method might be unique to gadgeteering. 'Course, I don’t know that for sure since I’ve never done anything else with it.