yes you are correct. the assignment is to read enable and on values for a set of 5 heaters, another set of 5 heaters, then a set of 3 heaters and another set of 3 heaters. Then temperature readings for those heaters are to be read. This is done until the data input stops (so everything needs to be in a while loop).
Code:
#include <stdio.h>
#include <unistd.h>
#include <time.h>
enum on_enable {ENABLE=0, ON=1};
enum time_constants {ZERO=0, FOUR_SECONDS=4};
enum number_contants {HEATERS=5, STATES=2, BATT=3, IMU=3};
main()
{
int lower_state[HEATERS][STATES];
int upper_state[HEATERS][STATES];
int batt_state[BATT][STATES];
int imu_state[IMU][STATES];
int n;
int m;
int i;
int j;
int last_read;
double lower_temp[HEATERS];
double upper_temp[HEATERS];
double batt[BATT];
double imu[IMU];
char on_state_labels[2][4]={{"ON "},
{"OFF"}};
char enable_state_labels[2][9]={{"ENABLED "},
{"DISABLED"}};
time_t mytime;
while(1==1)
{
for (n=0; n<5; n++)
{
scanf("%d %d", &lower_state[n][ENABLE], &lower_state[n][ON]);
printf(" LOWER_%d %s "
,n,on_state_labels[lower_state[n][ON]]);
printf("%s\n", enable_state_labels[lower_state[n][ENABLE]]);
}
printf("\x1b[5A");
for (n=0; n<5; n++)
{
scanf("%d %d", &upper_state[n][ENABLE], &upper_state[n][ON]);
printf("UPPER_%d %s ",n,on_state_labels[upper_state[n][ON]]);
printf("%s\n", enable_state_labels[upper_state[n][ENABLE]]);
}
printf("\n");
for (m=0; m<3; m++)
{
scanf("%d %d", &batt_state[m][ENABLE], &batt_state[m][ON]);
printf(" BATT_%d %s "
,m,on_state_labels[batt_state[m][ON]]);
printf("%s\n", enable_state_labels[batt_state[m][ENABLE]]);
}
printf("\x1b[3A");
for (m=0; m<3; m++)
{
scanf("%d %d", &imu_state[m][ENABLE], &imu_state[m][ON]);
printf("IMU_%d %s ",m,on_state_labels[imu_state[m][ON]]);
printf("%s\n", enable_state_labels[imu_state[m][ON]]);
}
for (n=0; n<5; n++)
{
scanf("%lf", &lower_temp[HEATERS]);
printf("%s", lower_temp[HEATERS]);
}
mytime = time(ZERO);
printf("%s",ctime(&mytime));
mytime = time(ZERO);
printf("%s",ctime(&mytime));
printf("\x1b[0A");
sleep(FOUR_SECONDS);
}
}
This is the entire code that I have so far. It's obviously still a huge work in progress, but if you feel up to it you can see if I'm on the right track. I have to go to work now unfortunately, but thank you guys for all your help so far, it's much appreciated. This is so frustrating!