Skip to content

Arduino

Wokwi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
void setup() {
  pinMode(0, OUTPUT);  // Set GP0 as an output
}

void loop() {
  digitalWrite(0, HIGH);  // Turn the LED ON
  delay(500);             // Wait for 500ms
  digitalWrite(0, LOW);   // Turn the LED OFF
  delay(500);             // Wait for 500ms
}

RTFM

Simulation features

Peripheral Status Notes
Processor core ✔️ Only a single core is simulated
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const int LED_PIN0 = 0;
const int LED_PIN1 = 1;

int count0 = 0;
int count1 = 0;
bool led_flg0 = true;
bool led_flg1 = true;

/* ---- Task for Core 0 ---- */
void setup() {
  pinMode(LED_PIN0, OUTPUT);
  delay(1000);
  Serial.println("core0:start....");
}

void loop() {
  count0 = count0 + 1;
  digitalWrite(LED_PIN0, led_flg0);
  led_flg0 = !led_flg0;
  delay(2000);
}

/* ---- Task for Core 1 ---- */
void setup1() {
  pinMode(LED_PIN1, OUTPUT);
  delay(1000);
  Serial.println("core1:start....");
}

void loop1() {
  count1 = count1 + 1;
  digitalWrite(LED_PIN1, led_flg1);
  led_flg1 = !led_flg1;
  delay(2000);
}