Magicbit
Published

Toit with Magicbit

In this tutorial, we show you how to work Toit with Magicbit(ESP32).

BeginnerProtip1 hour324
Toit with Magicbit

Things used in this project

Hardware components

magicbit
×1

Software apps and online services

Toit.io

Story

Read more

Code

LED_Blink (Toit)

MicroPython
import gpio

// The red LED is connected to pin 17.
LED1 ::= gpio.Pin.out 17
// The green LED is connected to pin 18.
LED2 ::= gpio.Pin.out 18

main:
  // Note the double `::` on the next two lines.
  // Start a task that runs the my_task_1 function.
  task:: my_task_1
  // Start a second task that runs my_task_2.
  task:: my_task_2

my_task_1:
  while true:
    sleep --ms=500
    LED1.set 1
    sleep --ms=500
    LED1.set 0

my_task_2:
  while true:
    sleep --ms=123
    LED2.set 1
    sleep --ms=123
    LED2.set 0

Credits

Magicbit
57 projects • 35 followers
Magicbit is an integrated development platform based on ESP32 for learning, prototyping, coding, electronics, robotics, IoT and more.
Contact

Comments

Please log in or sign up to comment.