Samples_GPIO - gfd-dennou-club/mrubyc-esp32 GitHub Wiki
GPIO ăŻă©ăčăźăĄăœăăă«ă€ăăŠăŻïŒClass_GPIO ăćç §ăăăăïŒ
LED (GPIO 13) ă 1 ç§ăăă«çčæ» ăăăăăă°ă©ă ăŻä»„äžăźăăă«æžăă°èŻăïŒ
#ă€ăłăčăżăłăčăźäœæ. LED ăźæ„ç¶ăăăŠăăăăł (GPIO 13) ăćșćă«èšćź. led1 = GPIO.new( 13, GPIO::OUT ) loop do led1.write(1) # pin ăźć€ăăă€ăŹăă«ă« sleep 1 # 1 ç§ćŸ 〠led1.write(0) # pin ăźć€ăăăŒăŹăă«ă« sleep 1 # 1 ç§ćŸ 〠end
ăčă€ăă(GPIO 34)ăš LED (GPIO 13) ăéŁćăăăć Žćă«ăŻïŒä»„äžăźăăăȘăăă°ă©ă ăæžăă°èŻă.
# LED ăźæ„ç¶ăăăŠăăăăł (GPIO 13) ăćșćă«èšćź. led1 = GPIO.new( 13, GPIO::OUT ) # ăčă€ăăăźæ„ç¶ăăăŠăăăăł (GPIO 34) ăć „ćă«èšćź. ăă«ăąăăăă. sw1 = GPIO.new( 34, GPIO::IN, GPIO::PULL_UP ) loop do if (sw1.read == 0) #ăčă€ăăăźăăłăźć€ăăăŒăŹăă«ăźæ led1.write(1) # LED ăźăăłăźć€ăăă€ăŹăă«ă« else led1.write(0) # LED ăźăăłăźć€ăăăŒăŹăă«ă« end sleep 1 end