int main(void) { //init_USART(); init_SPI(); init_ster(); lcd_init(); LCD_DISPLAY(LCDDISPLAY); lcd_puts("KAROL"); if(GetRegister(STATUS) == 0x0E) { LED_ON; _delay_ms(1000); LED_OFF; _delay_ms(1000); } LCD_CLEAR; NRF24L01_init(); while(1) { reset(); receive_payload(); if(((GetRegister(STATUS) & (1<<RX_DR)) != 0)) { LED_ON; _delay_ms(10); //LCD_CLEAR; receive_buffer=WriteReadToNrf(R,R_RX_PAYLOAD,receive_buffer,5); X_acc=receive_buffer[0]; Y_acc=receive_buffer[1]; Z_acc=receive_buffer[2]; ster(X_acc,Y_acc); LCD_LOCATE(0,0); sprintf(Text_buff,"%3d",X_acc); lcd_puts(Text_buff); LCD_LOCATE(0,1); sprintf(Text_buff,"%3d",Y_acc); lcd_puts(Text_buff); LED_OFF; } } }
void main( void ) { // Stop watchdog timer to prevent time out reset WDTCTL = WDTPW + WDTHOLD; button_init(); led_init(); Clock_Init(); NRF24L01_init(1,1); NRF24L01_ConfigMode(MODETX); NRF24L01_TxPacket(temp); NRF24L01_ConfigMode(MODERX); while(1) { LPM3; //SMG_Display(rece_buf[0]); led1_on(0); Delay_ms(300); led1_off(0); Delay_ms(300); } }