This could be a lot of work if you have to keep downloading to hardware each time.
Abstraction (computer science) - Wikipedia, the free encyclopedia
Think about how you might prototype this on your PC.
For example,
Code:
#ifdef PC
void turnMotor ( int motorID, int direction, int numSteps ) {
printf("Turning motor %d in direction %d for %d steps\n", motorID, direction, numSteps );
}
#else
void turnMotor ( int motorID, int direction, int numSteps ) {
// here you write some bits to some I/O ports on the device to cause
// a motor to turn.
}
#endif
Sensors are a little trickier; simple tests could be
Code:
#ifdef PC
// version 2 could read from a file of actual data recorded from
// your real device
int readTemperature ( int sensorID ) {
static int samples[] = { 10, 11, 12, 3, 99, 12, 12, 13 };
static int count = 0;
int result = samples[count];
count = ( count + 1 ) % 8;
return result;
}
#else
int readTemperature ( int sensorID ) {
// do something with a sensor, and return value
}
#endif
By creating a lot of little functions like these to describe the environment on the hardware, you should be able to get a LOT of testing done quite quickly on your PC. When you're happy with some progress, then recompile it for the target.
> I want to be sure I make the program extensible.
If you're that short on resources, go for something simple that works.
Extensibility comes with price tags (more CPU, more memory, more time to develop).