Alright, I have been searching all over the place for a solution for this and have been stuck for some hours now. I am working with a very specific piece of hardware but that shouldn't have anything to do with the actual compilation of my program.
Code:
/** Includes */
#include <avr/io.h>
#include <util/delay.h>
#include "adc.h"
#include <stdlib.h>
#include <stdio.h>
/** Constants */
#define F_CPU 1000000U
/** Global Variables */
/** Functions */
/** The initialize() function initializes all of the Data Direction Registers for the Wunderboard. Before making changes to DDRx registers, ensure that you have read the peripherals section of the Wunderboard user guide.*/
void initialize (void) {
/** Port A is the switches and buttons. They should always be inputs. ( 0 = Input and 1 = Output )*/
DDRA=0b00000000;
/** Port B has the LED Array color control, SD card, and audio-out on it. Leave DDRB alone. ( 0 = Input and 1 = Output )*/
DDRB=0b11000000;
/** Port C is for the 'row' of the LED array. They should always be outputs. ( 0 = Input and 1 = Output )*/
DDRC=0b11111111;
/** Port D has the Serial on it. Leave DDRB alone. ( 0 = Input and 1 = Output )*/
DDRD=0b00000000;
/** Port E has the LED Array Column control out on it. Leave DDRE alone. ( 0 = Input and 1 = Output )*/
DDRE=0b00000111;
/** Port F has the accelerometer and audio-in on it. Leave DDRF alone. ( 0 = Input and 1 = Output )*/
DDRF=0b00000000;
}
void clearArray(void)
{
PORTB &= ~((1 << PB6) | (1 << PB7)); // Disable latches
PORTC = 0x00;
PORTB |= (1 << PB6) | (1 << PB7); // Enable latches
PORTB &= ~((1 << PB6) | (1 << PB7)); // Disable latches
}
/** Main Function */
int main (void) {
/** Local Varibles */
int a= ((0b11000111-0b10110111)/0b00001000);
unsigned char q=1<<((read_adc(6)-0b10110111)/a); //Y Axis
unsigned char w=((read_adc(5)-0b10110111)/a); //X Axis
initialize();
clearArray();
while(1){
q=1<<((read_adc(6)-0b10110111)/a);
w=((read_adc(5)-0b10110111)/a);
//system("xdotool getmouselocation > /home/gordy/Documents/mouseLoc");
if(q <= (((0b11000111-0b10110111)/2)+ 0b10111000) && q >= (((0b11000111-0b10110111)/2)- 0b10110110))
{
//don't move mouse
}
else if(q > (((0b11000111-0b10110111)/2)+ 0b10111000))
{
//mouse will move +Y
}
else if(q < (((0b11000111-0b10110111)/2)- 0b10110110))
{
//mouse will move -Y
}
if(w < (((0b11000111-0b10110111)/2)+ 0b10111000) && w > (((0b11000111-0b10110111)/2)- 0b10110110))
{
//mouse does not move in the X direction
}
if(w > (((0b11000111-0b10110111)/2)+ 0b10111000))
{
//mouse will move +X
}
if(w < (((0b11000111-0b10110111)/2)- 0b10110110))
{
//mouse will move -X
}
}
}//main
My problem is that when I try to compile, it says
main.c:95: undefined reference to `system'
make: *** [main.elf] Error 1
I am thinking it might have something to do with the makefile (I did not create the makefile)
But I know that all you should need to use the system command is stdlib.h and I tested it in a separate file and the system function works, just not for this specific problem. Sorry for the specificity of the code, I really appreciate any help, thanks in advance.