for (auto& field : fields) {
knx.addListenGroupAddress(field.addr);
pinMode(field.port, OUTPUT); //Sets the Pin to output
digitalWrite(field.port, !field.value); //setup pins: lastValue 1 sets pin to 0 (activates it)
delay(50);
}
If running with old atmega I can't see delay, releays works like virtually same time, but with new one, I can actually count them, took like second to do full array that has 16 entitys.
same code, same programmer, same hardware to insert them. I try do do multiple times but no luck, new ones are always slower
new(slow) atmegas RS connections doesnt work at all, I think its something to do with speed.
How did you flash that AtMega? Out of the box ( as it comes from ATMEL/MicroChip ) the processor runs with its internal oszilator and the clockspeed is 1MHz. You have to set the fuses correctly to use an external 16MHz quartz.
Uploading the code does not change the fuses, these are 2 discrete steps. The IDE builds code to run on the speed of chip you select, making the 'timing' correct for delays etc.
When you program the fuses, this sets the CHIP to use the correct timing method, eg Internal Oscillator at various speeds, or use external clock sources, these can be almost anything from 32 KHz to 20 MHz.
You are not the first to be caught out by this, and you will not be the last. I've had a large, online retailer of electronics send me a board that did not work as designed, and it was down to the fuses!