Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions blink-pico-w/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Overview

A blink example for Raspberry Pi Pico W. Contrary to the regular Pico, the LED on this board is connected to the WiFi chip (CYW43).

# Code

Turn on and off the on-board LED for every seconds.

```js
const cyw43_arch = require('cyw43_arch');
const led = 0
let state = 1;

setInterval(() => {
cyw43_arch.gpioPut(led, state);
state = (state + 1 ) % 2; // Toggle between 1 and 0
}, 1000);
```

# See also

- [pinMode()](https://kalumajs.org/docs/api/digital-io#pinmode)
- [digitalToggle()](https://kalumajs.org/docs/api/digital-io#digitaltoggle)
- [setInterval()](https://kalumajs.org/docs/api/timers#setinterval)
8 changes: 8 additions & 0 deletions blink-pico-w/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const cyw43_arch = require('cyw43_arch');
const led = 0
let state = 1;

setInterval(() => {
cyw43_arch.gpioPut(led, state);
state = (state + 1 ) % 2; // Toggle between 1 and 0
}, 1000);
4 changes: 4 additions & 0 deletions blink-pico-w/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "blink-pico-w",
"description": "Blink the on-board LED on a Raspberry Pico W"
}