Created
October 22, 2023 04:54
-
-
Save abuvanth/339aba8523d1ccde42a10ade32d19351 to your computer and use it in GitHub Desktop.
Control esp32 onboard LED using Cyberfly IoT platform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from data_shipper import CyberflyDataShipper | |
import machine | |
import time | |
key_pair = {"publicKey":"37a720dcf056387df1d9c85cda3cbff55aa9084b6eaee8bb9fde20c684fd9418","secretKey":"f18adeab3f38b5531f6fcd9ae05d3fb0ea42f0314ea5b93f0d7114d14ff3daac"} | |
device_id="0afcff85-5b57-4136-aa6c-2897cc5b6b88" | |
client = CyberflyDataShipper(device_id=device_id, key_pair=key_pair, ssid="Abu",wifi_password="abu12345678", network_id="testnet04") | |
@client.on_message() | |
def do_something(data): | |
print(data) | |
led = machine.Pin(int(data['pin_no']), machine.Pin.OUT) | |
led.value(data['state']) | |
while 1: | |
client.check_msg() | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment