Esempio n. 1
0
int main(void) {
    // define and initialise an array of int8_t's called array
    int8_t array[] = {-4, 31, -51, 62, -45, 58, -99, 105, -6, 60, 37, 106, -106, -96, 97, 50, -116, -38, 38, -52, -64, -68, 75, 117, 111, 100, 116, 11, 46, -64, -82, -74, -3, 0, 44, 64, -6, 1, -119, 123};
    // define and initialise a int8_t called min
    int8_t min = array[0];
    // define and initialsie a int8_t called max
    int8_t max = array[0];

    // call find_min_max here, thereby getting the function to modify min and max to the correct values
    find_min_max(&array[0],sizeof(array), &max, &min);

    // initialise pins connected to LEDs
    *(uint32_t*)0x40021014 = 0x40000;
    *(uint32_t*)0x48000400 = 0x5555;

    //optional initialization for interrupt timer

    for(EVER) {
        // display max on the LEDs
        *(uint8_t*)0x48000414 = max;
        // delay for 1 s, possibly by calling delay function
        basic_delay(650000);
        // display min on the LEDs
        *(uint8_t*)0x48000414 = min;
        // delay for 1 s
        basic_delay(650000);
    }
    
    //Return exit status code
    return 0;
}
Esempio n. 2
0
void init_positions() 
{
	BASE 		= ANG_BASE_MID; 
	SHOULDER 	= ANG_SHOULDER_MID; 
	ELBOW 		= ANG_ELBOW_MID; 
	GRIP 		= ANG_GRIP_MIN;
	WRIST		= ANG_WRIST_MAX; 
	
	basic_delay(300); 
}