Remote I/O Switchx4 LEDx4 AINx2(Battery,Potentiometer) OUTx8 INx8 nRFUARTの改造版 ライブラリアップデートに注意 BLE_API,nRF51822,mbed
Dependencies: BLE_API mbed nRF51822
Fork of BLE_LoopbackUART by
Diff: main.cpp
- Revision:
- 16:5df99e9291af
- Parent:
- 15:828ad860628f
- Child:
- 17:663243430dc2
--- a/main.cpp Mon Dec 26 07:04:53 2016 +0000 +++ b/main.cpp Wed Dec 28 18:10:12 2016 +0000 @@ -145,7 +145,7 @@ // stop blinking when we connect LED_1 = LED_OFF; read_IN(); - ticker.attach(periodicCallback_sw_read, 0.1); + ticker.attach(periodicCallback_sw_read, 0.05); update_characteristic_fg = true; first_update_fg = true; adc_update_cnt = 0; @@ -215,7 +215,7 @@ change_input_fg = true; } adc_update_cnt++; - if( adc_update_cnt > 10 ) + if( adc_update_cnt > 5 ) { adc_update_cnt = 0; change_input_fg = true; @@ -234,6 +234,7 @@ DEBUG.baud(9600); port_clear(); read_IN(); + read_IN(); DEBUG.printf("\r\n"); DEBUG.printf("BLE remote I/O \r\n"); DEBUG.printf(" nRFUART version\r\n"); @@ -279,6 +280,7 @@ DEBUG.printf("board I/O debug \r\n"); output_buf = 0; read_IN(); + read_IN(); while( 1 ) { wait_ms(200); @@ -374,9 +376,9 @@ if( DI_7 == 0 ){ input_now |= 0x4000; } if( DI_8 == 0 ){ input_now |= 0x8000; } ain1_old = ain1_now; + ain1_now = AIN_1.read_u16(); ain2_old = ain2_now; - ain1_now = AIN_1.read_u16(); - ain2_now = AIN_2.read_u16();; + ain2_now = AIN_2.read_u16(); } void port_clear( void )