Beginners: please read this post and this post before posting to the forum.
0 Members and 1 Guest are viewing this topic.
but whats throwing my for a loop is your PORTS_ALL_ON(port_letter,number) function, does it turn on the number for all 3 ports, or for all numbers of port?
#define BUTTON_DDR DDRB#define BUTTON_PORT PINB#define BUTTON_MASK (1 << 3) // the button is connected to B3#define SENSOR_POWER_DDR DDRA#define SENSOR_POWER_PORT PORTA#define SENSOR_POWER_MASK (1 << 2) // the MOSFET is controlled by A2....// Make the sensor power MOSFET pin be an output, and set it highSENSOR_POWER_DDR |= SENSOR_POWER_MASK;SENSOR_POWER_PORT &= ~SENSOR_POWER_MASK;// Set up the button to be an inputBUTTON_DDR &= ~BUTTON_MASK;// Test to see if the button is pressedif (!(BUTTON_PORT & BUTTON_MASK)) printf ("Button Pressed\n");