This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

External sensor data convert digital data on nRF51822

static void button_event_handler(uint8_t pin_no, uint8_t button_action) { if (button_action == APP_BUTTON_PUSH) { switch (pin_no) { case HR_INC_BUTTON_PIN_NO: //push button 0 // Increase Heart Rate measurement m_cur_heart_rate += HEART_RATE_CHANGE; if (m_cur_heart_rate > MAX_HEART_RATE) { m_cur_heart_rate = MIN_HEART_RATE; // Loop back } break;

        case HR_DEC_BUTTON_PIN_NO: //push button 1
            // Decrease Heart Rate measurement
            m_cur_heart_rate -= HEART_RATE_CHANGE;
            if (m_cur_heart_rate < MIN_HEART_RATE)
            {
                m_cur_heart_rate = MAX_HEART_RATE; // Loop back
            }
            break;
            
        default:
            APP_ERROR_HANDLER(pin_no);
            break;
    }
}    

}

this example is ble_app_hrs 's button part. I want change this part. ( if I push button 0 , ADC enabling, if I push button 1 , ADC disenabling ) then digital data is transmitted to DK Kit through bluetooth.

I have some questions for solving this problem.

  1. where input 3-axis sensor's x-axis values? ( ADC pin? or other pin? )

  2. How convert sensor values to digital data?

  3. How write/read this data?

Related