I need to identify my devices and save stuff on eeprom at somepoint , so in my plan is kind of that:
Devices are running on KNX bus and idea is to wrote basic software to flash and config it thru bus.
but problem is, I can't add address for them while programming (as I dont know where it will go), so I planned to add button to each device, that would echo some "code" to network (so conf. software could identify device and Arduino would listen if that device is asked)
but what that code should be, I was thinking "time from start" or cpu cycles, but after reboot, its possible to have multiple Arduinos with same id? (if not configured yet)?
Then, lets say I get some solution for identifying and after first config (trough KNX bus), device would have unique address, lets say 1.2.1 and after that I could address messages directly to it.
lets assume all androids would be similar pin layout so software could just handle values in arrays (pseudo code) and I would know that grp_addr would be tied to physical port phys_port, not beautiful code, but trying to learn, but it should be ok (atleast it seems to be working)
unsigned int dev_addr = 1.2.1; //actually 16 bit string (4bit.4bit.8bit) unsigned int grp_addr= ["1/1/1", "1/1/2", "1/1/3", ...] //array of 16 bit (5/3/8 bit) strings ??? phys_port = [A0 , 5 , 6 , ...] //maybe save pin number, not sure yet, only using digital ones int type = [0 , 1 , 1 , ...] //0 = analog, 1 on digital int direction = [-1 , 1 , 1 , ...] //0 = input, 1 output (-1 = disabled, as its analog port, just input)
Technically nobody can touch bus itself, so I just did test where I setup address at code and were able to modify these values thru knx bus and it worked.
But now if I want to save these, I could have 30 min timer and if values differ from what is stored to eeprom, save them. or I could have physical button that would save it. that would allow me to try new config without degreading eeproms limited writes, but it needs me to go different buildings and open junction boxes.
or if im making button, should I use that button as an activator, that would let me have 30 min time to program after I have pressed it once, that would avoid accidentally modifying stuff, even if 2 devices would have same name?
which one sounds better (or other ideas?) I really don't know witch path to take.