diff --git a/02_Connecting to Wifi/readme.md b/02_Connecting to Wifi/readme.md new file mode 100644 index 0000000..f0e20ac --- /dev/null +++ b/02_Connecting to Wifi/readme.md @@ -0,0 +1,8 @@ +# 02_Connecting_to_Wifi +This program is to connect to WiFi using NodeMCU +To run the program use the following ampy command + + +```bash + ampy --port /dev/tty.SLAB_USBtoUART run wifi_connect.py +``` diff --git a/02_Connecting to Wifi/wifi_connect.py b/02_Connecting to Wifi/wifi_connect.py new file mode 100644 index 0000000..b977084 --- /dev/null +++ b/02_Connecting to Wifi/wifi_connect.py @@ -0,0 +1,9 @@ +import network + sta_if = network.WLAN(network.STA_IF) + if not sta_if.isconnected(): + print('Connecting to network...') + sta_if.active(True) + sta_if.connect('', '') + while not sta_if.isconnected(): + pass + print('Network config:', sta_if.ifconfig()) \ No newline at end of file diff --git a/03_RGB_LED/readme.md b/03_RGB_LED/readme.md new file mode 100644 index 0000000..ff2e697 --- /dev/null +++ b/03_RGB_LED/readme.md @@ -0,0 +1,10 @@ +# 02_RGB_LED_COLOUR_VARIATIONS +- This program is for controlling RGB LED using NodeMCU +- Run this program after setting up the hardware part. For more information visit : +[Controlling RGB LED using NOdeMCU](https://blog.thepodnet.com/nodemcu-rgb-led-using-micropython/) + +After setting up the circuit, run the program by using following ampy command in terminal + +```bash + ampy --port /dev/tty.SLAB_USBtoUART run rgb_led.py +``` diff --git a/03_RGB_LED/rgb_led.py b/03_RGB_LED/rgb_led.py new file mode 100644 index 0000000..7accd67 --- /dev/null +++ b/03_RGB_LED/rgb_led.py @@ -0,0 +1,20 @@ +import machine +import time + +blue = machine.Pin(14, machine.Pin.OUT) +red = machine.Pin(12, machine.Pin.OUT) +green = machine.Pin(13, machine.Pin.OUT) + +while True: + green.on() + time.sleep_ms(500) + green.off() + time.sleep_ms(500) + blue.off() + time.sleep_ms(500) + blue.on() + time.sleep_ms(500) + red.on() + time.sleep_ms(500) + red.off() + time.sleep_ms(500) \ No newline at end of file