TG Telegram Group & Channel
Micropython & IOT | United States America (US)
Create: Update:

اسکریپت Lua برای ماژول بلوتوث

LEDpin = 4

gpio.mode(LEDpin, gpio.OUTPUT)--set LED pin as output pin
gpio.write(LEDpin, gpio.LOW)— set LED state initially low

—begin uart with specs
uart.setup(0, 9600, 8, uart.PARITY_NONE, uart.STOPBITS_1, 1)
—set callback function on receive to make decision about LED on/off
uart.on("data",1,
function(data)
if(data == "1") then
gpio.write(LEDpin, gpio.HIGH)
print("LED ON")
elseif(data == "2") then
gpio.write(LEDpin, gpio.LOW)
print("LED OFF")
else
print("select proper option")
end
end, 0)

نکته : پسورد دیفالت ماژول بلوتوث برای اتصال 0000 یا 1234 می باشد.

@micropython_iot

اسکریپت Lua برای ماژول بلوتوث

LEDpin = 4

gpio.mode(LEDpin, gpio.OUTPUT)--set LED pin as output pin
gpio.write(LEDpin, gpio.LOW)— set LED state initially low

—begin uart with specs
uart.setup(0, 9600, 8, uart.PARITY_NONE, uart.STOPBITS_1, 1)
—set callback function on receive to make decision about LED on/off
uart.on("data",1,
function(data)
if(data == "1") then
gpio.write(LEDpin, gpio.HIGH)
print("LED ON")
elseif(data == "2") then
gpio.write(LEDpin, gpio.LOW)
print("LED OFF")
else
print("select proper option")
end
end, 0)

نکته : پسورد دیفالت ماژول بلوتوث برای اتصال 0000 یا 1234 می باشد.

@micropython_iot


>>Click here to continue<<

Micropython & IOT




Share with your best friend
VIEW MORE

United States America Popular Telegram Group (US)