[{"data":1,"prerenderedAt":30},["ShallowReactive",2],{"example-page-nrf-blinky":3},{"id":4,"info":5,"parts":6,"wired":20,"refs":21,"nets":22,"moreNets":23,"code":24},"nrf-blinky","Real Zephyr firmware (blinky) on the Cortex-M4 emulator: P0.13 → 330 Ω → LED, button on P0.11. Swap the firmware in the inspector (button, fade_led, hello_world …).",[7,10,12,14,16,18],[8,9],"button",1,[11,9],"capacitor",[13,9],"led",[15,9],"nrf52840",[17,9],"resistor",[19,9],"vdc",true,{},[],0,{"file":25,"lang":26,"text":27,"lines":28,"more":29},"src\u002Fmain.c","c","\u002F*\n * Copyright (c) 2016 Intel Corporation\n *\n * SPDX-License-Identifier: Apache-2.0\n *\u002F\n\n#include \u003Cstdio.h>\n#include \u003Czephyr\u002Fkernel.h>\n#include \u003Czephyr\u002Fdrivers\u002Fgpio.h>\n\n\u002F* 1000 msec = 1 sec *\u002F\n#define SLEEP_TIME_MS   1000\n\n\u002F* The devicetree node identifier for the \"led0\" alias. *\u002F\n#define LED0_NODE DT_ALIAS(led0)\n\n\u002F*\n * A build error on this line means your board is unsupported.\n * See the sample documentation for information on how to fix this.\n *\u002F\nstatic const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);\n\nint main(void)\n{\n\tint ret;\n\tbool led_state = true;\n\n\tif (!gpio_is_ready_dt(&led)) {\n\t\treturn 0;\n\t}\n\n\tret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);\n\tif (ret \u003C 0) {\n\t\treturn 0;\n\t}\n\n\twhile (1) {\n\t\tret = gpio_pin_toggle_dt(&led);\n\t\tif (ret \u003C 0) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tled_state = !led_state;\n\t\tprintf(\"LED state: %s\\n\", led_state ? \"ON\" : \"OFF\");\n\t\tk_msleep(SLEEP_TIME_MS);\n\t}\n\treturn 0;\n}",48,false,1796304400722]