|
|
|
@ -8,6 +8,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
uint8_t i = 0;
|
|
|
|
|
uint8_t a = '0';
|
|
|
|
|
bool latch = false;
|
|
|
|
|
bool latch_old = false;
|
|
|
|
|
stmStart();
|
|
|
|
|
|
|
|
|
|
delayInitMs(8000000, 1000);
|
|
|
|
@ -32,7 +34,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
//blinks 10 times to indicate the sicsessfull init if the device
|
|
|
|
|
for(i = 0 ; i < 10 ; i++)
|
|
|
|
|
{
|
|
|
|
|
// delayMs(100);
|
|
|
|
|
delayMs(100);
|
|
|
|
|
pinToggle(pinB3);
|
|
|
|
|
// delayMs(100);
|
|
|
|
|
}
|
|
|
|
@ -43,18 +45,29 @@ int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
//USART will rteturn what wou type and trun led on if you press "1"
|
|
|
|
|
a = usartGetChar(usart2);
|
|
|
|
|
usartSendChar(usart2, a);
|
|
|
|
|
if(a == '1')
|
|
|
|
|
{
|
|
|
|
|
usartSendChar(usart2, a);
|
|
|
|
|
|
|
|
|
|
if(a == '1') {
|
|
|
|
|
pinWrite(pinB3,1);
|
|
|
|
|
} else if(a == '0'){
|
|
|
|
|
pinWrite(pinB3,0);
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
if(a == '1' && latch != latch_old)
|
|
|
|
|
{
|
|
|
|
|
pinToggle(pinB3);
|
|
|
|
|
//pinWrite(pinB3,1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pinWrite(pinB3,0);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
//test if the gpio port works as an input
|
|
|
|
|
if(pinRead(pinA0))
|
|
|
|
|
if(pinRead(pinA0) && !latch_old)
|
|
|
|
|
{
|
|
|
|
|
pinWrite(pinB3,1);
|
|
|
|
|
}
|
|
|
|
@ -62,6 +75,7 @@ int main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
pinWrite(pinB3,0);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
// delayMs(100);
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|