Chat freely about anything...

User avatar
By ChrisSparks
#52763 I was taking the gpio demo from nodemcu.com and trying to control my relay with the NodeMCU board. I noticed that when I said the Pins were 1, 2, 3, and 4, that it would always turn on D8.

Why is this?
User avatar
By ChrisSparks
#52804 I had done some testing: I know we have 12 pins but for some reason I couldn't work with 10 or 11 (not GPIO designation).

turn on pins:
1 HIGH
2 HIGH
3 HIGH
4 HIGH
5 HIGH
6 HIGH
7 HIGH
8 LOW
9 HIGH
10 Skip
11 Skip
12 HIGH

turn off pins
1 LOW
2 LOW
3 HIGH
4 HIGH
5 LOW
6 LOW
7 LOW
8 LOW
9 HIGH
10 Skip
11 Skip
12 LOW

It seems pins 1, 2, 5, 6, 7, 8 and 12 all behave when I go high and then to low.
Pins 3, 4, and 9 stay high.
Pins 10, 11 are non-functional? I get a hardware reset when I try to use these.

Any clues?

------------ lua code ------------
print("start pinny.lua")

--tmr.alarm(1, 2000, tmr.ALARM_SINGLE,function()
--tmr.alarm(1, 2000, tmr.ALARM_SEMI,function()
tmr.alarm(1, 2000, tmr.ALARM_AUTO,function()

local pin = 1
local max_pin = 12
local i = 1

while (i <= 2) do

if (i == 1) then
print("\nturn on pins")
else
print("\nturn off pins")
end

while (pin <= max_pin) do
gpio.mode(pin,gpio.OUTPUT)

if (i == 1) then
gpio.write(pin,gpio.HIGH)
else
gpio.write(pin,gpio.LOW)
end

gpio.mode(pin,gpio.INPUT)

if (gpio.read(pin) == 1) then
print(pin, "HIGH")
else
print(pin, "LOW")
end

pin = pin + 1

-- can't use 10 for some reason
if (pin == 10) then
print (pin, "Skip")
print ("11", "Skip")

pin = 12
end
end

i = i + 1
pin = 1
end

i = 1
end)