Skip to content

Commit caf8642

Browse files
committed
feat(wokwi-led-ring): arduino uno test
1 parent 9b4b2fe commit caf8642

File tree

9 files changed

+85
-1
lines changed

9 files changed

+85
-1
lines changed

.github/workflows/wokwi-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ jobs:
4343
- name: lcd1602-esp32-c3
4444
path: wokwi-lcd1602/lcd-i2c-esp32-c3
4545
scenario: lcd1602.test.yaml
46+
- name: led-ring-uno
47+
path: wokwi-led-ring/neopixel-uno
48+
scenario: neopixel.test.yaml
4649
- name: microsd-card-esp32
4750
path: wokwi-microsd-card/sd-esp32
4851
scenario: sd.test.yaml

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ This repository contains a set of test projects for many Wokwi parts. The tests
1818
- wokwi-lcd1602
1919
- [Arduino Uno](./wokwi-lcd1602/lcd-uno/)
2020
- [ESP32-C3 + I2C](./wokwi-lcd1602/lcd-i2c-esp32-c3/)
21+
- wokwi-led-ring
22+
- [Arduino Uno](./wokwi-led-ring/neopixel-uno/)
2123
- wokwi-micro-sd
2224
- [ESP32](./wokwi-micro-sd/sd-esp32/)
2325
- wokwi-photoresistor-sensor

board-ssd1306/oled-esp32/ssd1306.test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: 'ESP32 SSD1306 OLED Test'
22
version: 1
3-
author: 'Test Author'
3+
author: 'Uri Shaked'
44

55
steps:
66
- wait-serial: 'Display initialized'
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"version": 1,
3+
"author": "Uri Shaked",
4+
"editor": "wokwi",
5+
"parts": [
6+
{ "type": "wokwi-arduino-uno", "id": "uno", "top": 0, "left": 0, "attrs": {} },
7+
{
8+
"type": "wokwi-led-ring",
9+
"id": "ring1",
10+
"top": -239.49,
11+
"left": 25.13,
12+
"attrs": { "pixels": "24" }
13+
}
14+
],
15+
"connections": [
16+
["ring1:VCC", "uno:5V", "red", ["v11.92", "h-120.06", "v237.68", "h164.86"]],
17+
["uno:2", "ring1:DIN", "green", ["v-28.2", "h-92.5"]],
18+
["ring1:GND", "uno:GND.1", "black", ["v21.52", "h-9.73"]]
19+
],
20+
"dependencies": {}
21+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: 'Arduino LED Ring Test'
2+
version: 1
3+
author: 'Uri Shaked'
4+
5+
steps:
6+
- wait-serial: 'LEDs ready.'
7+
- take-screenshot:
8+
part-id: 'ring1'
9+
compare-with: 'screenshots/led-ring.png'
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[env:uno]
2+
platform = atmelavr
3+
board = uno
4+
framework = arduino
5+
lib_deps =
6+
Adafruit NeoPixel
163 Bytes
Loading
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#include <Arduino.h>
2+
#include <Adafruit_NeoPixel.h>
3+
4+
#define PIXEL_COUNT 24
5+
6+
Adafruit_NeoPixel ring = Adafruit_NeoPixel(24, 2);
7+
8+
int32_t Wheel(byte WheelPos);
9+
10+
void setup() {
11+
Serial.begin(115200);
12+
ring.begin();
13+
ring.setBrightness(255);
14+
15+
for (uint16_t j = 0; j < 256 * 5; j++) {
16+
for (uint16_t i = 0; i < ring.numPixels(); i++) {
17+
ring.setPixelColor(i, Wheel(((i * 256 / ring.numPixels()) + j) & 255));
18+
}
19+
}
20+
21+
ring.show();
22+
Serial.println("LEDs ready.");
23+
}
24+
25+
void loop() {
26+
}
27+
28+
int32_t Wheel(byte WheelPos) {
29+
WheelPos = 255 - WheelPos;
30+
if (WheelPos < 85) {
31+
return ring.Color(255 - WheelPos * 3, 0, WheelPos * 3);
32+
}
33+
if (WheelPos < 170) {
34+
WheelPos -= 85;
35+
return ring.Color(0, WheelPos * 3, 255 - WheelPos * 3);
36+
}
37+
WheelPos -= 170;
38+
return ring.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
39+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[wokwi]
2+
version = 1
3+
firmware = '.pio/build/uno/firmware.elf'
4+
elf = '.pio/build/uno/firmware.elf'

0 commit comments

Comments
 (0)