Put a quick test circuit together on a breadboard.
Had some MSP430G2211 in the parts bin so used one of those. Using code composer studio and LaunchPad to program / debug. Used Grace to easily configure the pins, P1.6 has internal pull up resistor and the hall effect output. Pin P1.1 has a 2N3904 NPN with the beeper as a low side switch. Basic code for testing everything and the initial video:
int main(void)
{
Grace_init(); // Activate Grace-generated configuration
while(1)
{
if (P1IN & BIT6) //Pin 1.6 is low whenever magnet is detected
{
//Pin 1.6 is high, turn off beeper
P1OUT &= ~(BIT1); //Clear output bit
}
else
{
//Pin 1.6 is low, turn on beeper
P1OUT |= BIT1; //Set output bit
}
}
}
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.