Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed nRF51822
Fork of nRF51822_SimpleControls by
Revision 13:daadb429b388, committed 2017-03-01
- Comitter:
- MarkSPA
- Date:
- Wed Mar 01 21:10:07 2017 +0000
- Parent:
- 12:99c81e757506
- Commit message:
- Cleaned up version for DRHS
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Dec 22 20:48:49 2016 +0000
+++ b/main.cpp Wed Mar 01 21:10:07 2017 +0000
@@ -36,7 +36,7 @@
#define PWM_PIN P0_16 //D6
#define SERVO_PIN P0_14 //D10
#define ANALOG_IN_PIN P0_6 //A5
-#define BB_DIG_OUT_PIN P0_8 //D1
+#define LED_DIG_OUT_PIN P0_8 //RTS
#define LED_HEADER 0x01
#define ONOFF_HEADER 0x11
@@ -71,15 +71,13 @@
//Serial pc(USBTX, USBRX);
static uint8_t old_state = 0;
neopixel_strip_t m_strip;
-//uint8_t dig_pin_num = BB_DIG_OUT_PIN; //DIGITAL_OUT_PIN; //6;
-uint8_t dig_pin_num = BB_DIG_OUT_PIN;
-//uint8_t leds_per_strip = 4; //24;
+uint8_t dig_pin_num = LED_DIG_OUT_PIN;
uint8_t slow_count = 0;
//uint8_t error;
-uint8_t led_to_enable = 2; //10;
+uint8_t led_to_enable = 2;
uint8_t red = 255;
-uint8_t green = 128;
-uint8_t blue = 159;
+uint8_t green = 0;
+uint8_t blue = 0;
uint8_t pattern = 0;
char mDeviceName[128];
@@ -124,11 +122,7 @@
{
//pc.printf("Disconnected \r\n");
//pc.printf("Restart advertising \r\n");
- //clear and remove strip
- //neopixel_clear(&m_strip);
- //neopixel_destroy(&m_strip);
- //strcpy(mDeviceName, "RRVA Cntd");
- //setup_advertising();
+
ble.startAdvertising();
}
@@ -149,8 +143,6 @@
//pc.printf("LED value received \r\n");
if(buf[1] == LEDS_ON) {
LEDS_ON_FLAG = 1;
- //neopixel_init(&m_strip, dig_pin_num, NUM_LEDS);
- //neopixel_clear(&m_strip);
} else if(buf[1] == LEDS_OFF) {
LEDS_ON_FLAG = 0;
neopixel_init(&m_strip, dig_pin_num, NUM_LEDS);
@@ -287,8 +279,7 @@
(const uint8_t *)&mDeviceName, length);
ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS,
(const uint8_t *)uart_base_uuid_rev, sizeof(uart_base_uuid));
- // 100ms; in multiples of 0.625ms.
- //ble.setAdvertisingInterval(160);
+ // In multiples of 0.625ms.
ble.setAdvertisingInterval(80);
ble.addService(uartService);
ble.startAdvertising();
