RBL Simple Controls app additional input readings (urgent)


#1

Hi there! I’m on a serious time crunch and would be deeply grateful if anyone could help me out.

I was looking through the code for the Simple Controls app on both the Arduino side & the App side(Android) and was wondering, if I wanted to read another 2 Analog inputs from the BLEShield, how would I go around doing it?

Currently from what I could see, on the Arduino side,
uint16_t value = analogRead(ANALOG_IN_PIN);
ble_write(0x0B);
ble_write(value >> 8);
ble_write(value);

And on the App side(Android),

private void readAnalogInValue(byte[] data) {
for (int i = 0; i < data.length; i += 3) {
if (data[i] == 0x0B) {
int Value;

			Value = ((data[i + 1] << 8) & 0x0000ff00)
					| (data[i + 2] & 0x000000ff);

			tv.setText(Value + "");
		}
	}
}

I’m guessing that I have to change both of these code but I’m not sure how to.


#2

A completely different alternative is to use the general purpose pfodApp (www.pfod.com.au) on the Android side to display and log the data.
The free pfodDesigner (https://www.forward.com.au/pfod/pfodDesigner/index.html) will generate Arduino code for the RedBearLab BLE Shield (https://www.forward.com.au/pfod/BLE/index.html#RedBearLab)
including display and plotting of analog inputs.


#3

Ohh okay… I will try. Thank you!


#4

I have published a detailed tutorial on how to program the NanoV2 for very low power <100uA all the time, advertising and connected send/receive
https://www.forward.com.au/pfod/BLE/LowPower/index.html
You can use either the NanoV2 programmer or this tutorial shows you how to use a BlackMagic Probe to program the NanoV2.
There is a free app that will generate the low power Arduino Sketch for you that lets you show control menus and plot and log data on your Android mobile, using pfodApp.

Also it seems that the nRF52 chip can get into debug mode by its self which draws mA’s instead of uA’s
Once you have programmed your chip, connect a 470R and 1nF directly from SWCLK to GND to stop noise triggering debug.