That example uses ABP.
You’re running into a security issue against replay attacks. Whenever you reset a device (or upload a new sketch), its counters will be reset to zero. But as there is no join process for ABP (like as used for OTAA), TTN does not know about that, and will reject all uplinks that have a counter value that is smaller than, or equal to, the last value that TTN knows.
When you reset an ABP device, you also need to reset the counters in TTN Console. Or for testing sometimes disabling the frame counter security helps. Neither is ever recommended for production nodes, but might even be troublesome for test nodes; see ABP node stopped working -> Fixed by creating new ABP.. Why? :)