Pulse counter that writes to MySQL Database

Good Morning,

A couple months ago I started trying to make a water meter connect with the cloud using a photon to count pulses. I received a lot of help from the community, especially from @Rftop he helped me going as far as to re-write my base code and included a ton of comments that helped me learn my way around it , and even going through my meter datasheet and troubleshooting the connections/settings to use.

Since then I have worked on it further and now have a pulse counter that triggers a particle webhook that sends information to a website to be stored into a MySQL database. I wanted to share in case it helps anyone searching the forums in the future, and to give you guys an opportunity to provide any feedback or point out any issues you can see.

I am a beginner and this is my first foray into it since learning HTML about 10 years ago haha so any advice is a big help.


Not a comment on the actual code, but neither the C++ syntax nor the PHP syntax is highlighted in the github repo files. Perhaps you could add file extensions onto the file names so that github properly identifies the code and can apply the syntax color coding. I did a quick google search for how to force that syntax highlighting but I didn’t find anything good. I think a file extension should do it though.


Thank you ! I will change that

Edit: just changed the extensions, looked like that did correct it

1 Like

You changed your IDEcode file to be a .h but that is a rather counterintuitive (to say the least) extension. .h should be reserved for header files that (mostly) don’t contain active code.
You’d rather want to call it .cpp (although even IDEcode doesn’t really give away what it does ;-)).
So maybe something like PulseCount.cpp would be better fitting.

For coding style you may also want to adopt a consistent, meaningful indentation scheme for C code as well as reducing blank lines. It often helps more to be able to see more of the active code correctly aligned in one screen page than breaking it up at arbitrarily places.


Thank you!

Edit: Changed the file name as you suggested and removed blank lines. I will take some time to read documentation on coding style to make it more cohesive going forward

1 Like

I am just now looking at different ways to monitor a pulse output. Thank you for sharing your code, it really helps. You and @Rftop did a great job. He has helped me out a number of times as well. Again thanks for sharing and great work.