Home › Forums › Environmental Sensors › Adding a new modbus sensor using current ones as inspiration. › Reply To: Adding a new modbus sensor using current ones as inspiration.
Hello Erik, sounds like you are on the path to learning Cpp. One issue to keep in mind is that the code is what happens, the reality check, the documentation is for readability. You may want to list what gas sensor you are looking at for the max help.
So I don’t follow your question – where do you get the code snippet from the first section which says there are two power pins “nlAdapterPower” and nanolevelPower which looks reasonable.
Then in the constructor KellerNanolevel.h they map to int8_t and int8_t – the name is only descriptive, it isn’t used for anything.
Part of new code is having a plan including figuring out what you need to learn. a) can you get enough technical detail for the plan to be likely to work – ie for your case the Modbus map of the gas sensor b) The other part of coding is set up a target test bench. b1) The first part of a test bench is proving that the test bench is working, b2) typically by enabling debug and checking the message flow on a known working sensor and then b3) making modifications for your new target sensor. Do you have ANY ModularSensors modbus sensors that you could start with? Just a thought 🙂