1686 views|0 replies

6818

Posts

11

Resources
The OP
 

【LuatOS-ESP32】Light up the LED [Copy link]

 

I am still on a business trip today. I was bored on the train, so I took out my notebook and wrote about LED lights:

View Schematic

Table 4-1

LED Number

Corresponding GPIO

Pin Function

describe

D4

IO12

GPIO12 Configuration

High level is effective

D5

IO13

GPIO13 Configuration

High level is effective

-- LuaTools需要PROJECT和VERSION这两个信息
PROJECT = 'helloworld + LED'
VERSION = '1.0.0'

-- 引入必要的库文件(lua编写), 内部库不需要require
local sys = require 'sys'
-- 开发板上的2个LED
local LED_D4 = gpio.setup(12, 0)  
local LED_D5 = gpio.setup(13, 0)
log.info('main', 'hello world')

print(_VERSION)

sys.taskInit(
    function()
        while 1 do
            LED_D4(0)
            LED_D5(1)
            sys.wait(500)
            LED_D4(1)
            LED_D5(0)
            sys.wait(500)
        end
    end
)

sys.timerLoopStart(function()
	print('hi, LuatOS')
end, 3000)
-- 用户代码已结束---------------------------------------------
-- 结尾总是这一句
sys.run()
-- sys.run()之后后面不要加任何语句!!!!!

Download to the development board:

Print information:

WeChat_20220627165244


This post is from Domestic Chip Exchange
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list