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 5:1f6311e0fc14, committed 2016-12-02
- Comitter:
- MarkSPA
- Date:
- Fri Dec 02 14:33:16 2016 +0000
- Parent:
- 4:c8515fbd2e44
- Child:
- 6:074f5ec7428c
- Commit message:
- Minor updates to light algorithms
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
patterns.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Nov 28 15:38:58 2016 +0000 +++ b/main.cpp Fri Dec 02 14:33:16 2016 +0000 @@ -53,7 +53,7 @@ #define PATTERN_RAINBOW 0x06 #define PATTERN_CANDY 0x07 #define PATTERN_SNOW 0x08 -#define PATTERN_ICE 0x09 +#define PATTERN_XMAS 0x09 #define LEDS_ON 0x01 #define LEDS_OFF 0x02 @@ -99,6 +99,7 @@ void candyChase(int wait, uint8_t numLEDs, neopixel_strip_t m_strip); void snowflakes(int wait, uint8_t numLEDs, neopixel_strip_t m_strip); void iceflakes(int delay, uint8_t numLEDs, neopixel_strip_t m_strip); +void xmas(int delay, uint8_t numLEDs, neopixel_strip_t m_strip); extern uint32_t ble_radio_notification_init(nrf_app_irq_priority_t irq_priority, nrf_radio_notification_distance_t distance, @@ -226,8 +227,8 @@ else if (pattern == PATTERN_SNOW) snowflakes(100, NUM_LEDS, m_strip); - else if (pattern == PATTERN_ICE) - iceflakes(100, NUM_LEDS, m_strip); + else if (pattern == PATTERN_XMAS) + xmas(200, NUM_LEDS, m_strip); } } @@ -266,7 +267,7 @@ ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED); ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); ble.accumulateAdvertisingPayload(GapAdvertisingData::SHORTENED_LOCAL_NAME, - (const uint8_t *)"rbCBand", sizeof("rbCBand") - 1); + (const uint8_t *)"rbCtrl02", sizeof("rbCtrl02") - 1); 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.
--- a/patterns.cpp Mon Nov 28 15:38:58 2016 +0000 +++ b/patterns.cpp Fri Dec 02 14:33:16 2016 +0000 @@ -102,4 +102,39 @@ neopixel_show(&m_strip); wait_ms(delay); } +} + +void xmas(int delay, uint8_t numLEDs, neopixel_strip_t m_strip) { + //All green + for (int j=0; j<numLEDs; j++) + neopixel_set_color(&m_strip, j, 0,255,0); + neopixel_show(&m_strip); + wait_ms(delay); + //All red + for (int j=0; j<numLEDs; j++) + neopixel_set_color(&m_strip, j, 255,0,0); + neopixel_show(&m_strip); + wait_ms(delay); + //Green with a red mover + for (int j=0; j<numLEDs; j++) + neopixel_set_color(&m_strip, j, 0,255,0); + neopixel_show(&m_strip); + wait_ms(delay); + for (int j=0; j<numLEDs; j++) + { + neopixel_set_color(&m_strip, j, 255,0,0); + neopixel_show(&m_strip); + wait_ms(delay); + } + //Red with a green mover + for (int j=0; j<numLEDs; j++) + neopixel_set_color(&m_strip, j, 255,0,0); + neopixel_show(&m_strip); + wait_ms(delay); + for (int j=0; j<numLEDs; j++) + { + neopixel_set_color(&m_strip, j, 0,255,0); + neopixel_show(&m_strip); + wait_ms(delay); + } } \ No newline at end of file