TimeAlarms capturing alarmID

Hi, I've found out that Alarm.alarmRepeat(HH,MM,SS, function); command returns alarm ID.

So I can read Alarm ID while it is set by following code:

AlarmID_t morningID = 0;
morningID = Alarm.alarmRepeat(1, 41, 0, MorningAlarm);        //Set daily Morning Alarm
Serial.print("Morning Alarm ID:");
Serial.println(morningID);

I dont understand what does AlarmID_t means?

I declare morningID as an integer as a trial and it works fine as well. Do you think it would cause any problems? Why wouldnt we easily declare it as int if it does not make any difference?

int morningID = 0;
morningID = Alarm.alarmRepeat(1, 41, 0, MorningAlarm);        //Set daily Morning Alarm
Serial.print("Morning Alarm ID:");
Serial.println(morningID);

gunaygurer:
Hi, I've found out that Alarm.alarmRepeat(HH,MM,SS, function); command returns alarm ID.

So I can read Alarm ID while it is set by following code:

AlarmID_t morningID = 0;

morningID = Alarm.alarmRepeat(1, 41, 0, MorningAlarm);        //Set daily Morning Alarm
Serial.print("Morning Alarm ID:");
Serial.println(morningID);




I dont understand what does AlarmID_t means?

It is a user defined type. If you look inside the library you are using, you will see exactly what type that is

typedef uint8_t AlarmID_t;

so it is an unsigned 8 bit value (aka byte).

The reason library developers do this is so they have future flexibility to change this. Say for example the library grows and this type needs to be 16 bits v. 8 bits. If your user code sticks to using AlarmID_t, then everything will continue to work after an upgrade. If you peek inside the library and make the decision to use 'byte' because it will work today, you are setting yourself up for a possible future problem.

Ok I understand. What about uint8_t? It again has a _t in the end. Does this just a representation to emphasize that it is a timestamp value? I've checked arduino references page but there is nothing written about this there.

Does this just a representation to emphasize that it is a timestamp value?

It is nothing to do with it being a timestamp, rather there is a widely used convention that _t is added to indicate that the name is a type to differentiate it from a variable name

adding to that convention, types that start with 'u' refer to unsigned and the number refers to how many bits it can hold so you get things like

int8_t
uint8_t
int16_t
uint16_t
int32_t
uint32_t

which the arduino IDE defines for you somewhere in one of the header files it automatically includes for you. You will see a lot of this in libraries where the coder wants a specific sized variable

Ok so what I understand is if I want to state the size of a variable I need to write the size value after int or uint and add _t at the end. So if I write uint8 only it wont work, I need to add _t as well.