Stephen Borsay
Published © GPL3+

LED Chaser: Programming the nRF52-DK with Mbed

This is an easy and quick way to get started developing with Nordics nRF52-DK in ARM's free mBed online compiler.

BeginnerShowcase (no instructions)1 hour2,294
LED Chaser: Programming the nRF52-DK with Mbed

Things used in this project

Hardware components

nRF52-DK
×1

Software apps and online services

Arm mbed

Story

Read more

Schematics

BLE and Radio for IoT

Code

mbed code for Nordic nRF52-DK blinky

Arduino
Paste into mbed online IDE, program uses all four onboard LEDs as a light chaser
#include "mbed.h"


DigitalOut myleds[] = {(LED1), (LED2), (LED3), (LED4)};
 
int main() {
    int i;
    int previous;
 
    while (1) {
        for (i = 0; i < 4; i++) {
            if (i == 0) 
                previous = 3;
            else 
                previous = i - 1;
            
            myleds[i] = 1;
            myleds[previous] = 0;
 
           // wait(0.2);
           Thread::wait(500);
        }
    }
}

Credits

Stephen Borsay

Stephen Borsay

11 projects • 72 followers
Computer Engineer: Embedded Systems and IoT. AWS IoT Hero www.udemy.com/user/stv/ device2cloud.net
Thanks to HW Yoon.

Comments