Fetch Tickers Data in MicroPython ESP32 IoT Device to Automate Trades:
For Instructions Watch The Video Here:
VIDEO
from machine import Pin
import network
import json
import urequests
led=Pin(2, Pin.OUT)
wlan=network.WLAN(network.STA_IF)
wlan.active(True)
# Read credentials from ss.txt
w = open('delta.txt', 'r').read().strip()
wc = json.loads(w)
wn = wc['in']
wp = wc['key']
print("Connecting to Wi-Fi:", wn)
wlan.connect(wn,wp)
# wlan.ifconfig()[1:3]
# urequests.get('https://api.ipify.org').text
symbol='BTCUSD'
headers={
'User-Agent': 'MicroPython',
'Accept': 'application/json'
}
data=urequests.get(f'https://api.india.delta.exchange/v2/tickers/{symbol}',headers=headers)
print(data.json())
Static IP MicroPython ESP32 IoT Device to Automate Trades:
For Instructions Watch The Video Here:
VIDEO
from machine import Pin
import network
import json
import urequests
led=Pin(2, Pin.OUT)
wlan=network.WLAN(network.STA_IF)
wlan.active(True)
# Read credentials from ss.txt
w = open('delta.txt', 'r').read().strip()
wc = json.loads(w)
wn = wc['in']
wp = wc['key']
print("Connecting to Wi-Fi:", wn)
wlan.connect(wn,wp)
print(wlan.ifconfig()[1:3])
print(urequests.get('https://api.ipify.org').text)
Connect MicroPython ESP32 IoT Device to WIFI:
For Instructions Watch The Video Here:
VIDEO
from machine import Pin
import network
import json
led=Pin(2, Pin.OUT)
wlan=network.WLAN(network.STA_IF)
wlan.active(True)
# Read credentials from ss.txt
w = open('ss.txt', 'r').read().strip()
wc = json.loads(w)
wn = wc['in']
wp = wc['key']
print("Connecting to Wi-Fi:", wn)
wlan.connect(wn,wp)
print(wlan.ifconfig()[2])
VIDEO
Get your USB Cable From YouTube Store Follow the Link :
In CMD Install esptool through PIP such as: pip install esptool
Erase Flash: c:\Python36\Lib\site-packages>esptool.py --port COM6 erase_flash
Write Flash: c:\Python36\Lib\site-packages>esptool.py --port COM6 write_flash 0x1000 C:\Users\PCNAME\Desktop/arduino/write_flash/esp32-20180511-v1.9.4.bin
Open your Putty Put as COM6(Your PORT) in Serial Line Box and in Speed 115200 then go for Connection type and Select as Serial and then go and Select Open. A Command Line Python will Be opened do type the programme or select the programme from import and run them.
In CMD Install ampy through PIP such as: pip install adafruit-ampy
Put Code in ESP32 development board through ampy as such : ampy --port COM6 put blinky.py
>>> from machine import Pin
>>> led=Pin(2,Pin.OUT)
>>> led.value(1)
>>> led.value(0)
>>>