This file contains hidden or 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
| import network | |
| from umqtt.simple import MQTTClient | |
| import time | |
| import machine | |
| MQTT_BROKER="192.168.1.5" | |
| MQTT_PORT = 1883 | |
| MQTT_CLIENT_ID="pico_client" | |
| led_green = machine.Pin(0, machine.Pin.OUT) |
This file contains hidden or 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
| import network | |
| from umqtt.simple import MQTTClient | |
| import time | |
| import machine | |
| MQTT_BROKER="YOUR_SYSTEM_IP" | |
| MQTT_PORT = 1883 | |
| MQTT_CLIENT_ID="pico_client" | |
| led_green = machine.Pin(0, machine.Pin.OUT) |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Raspberry Pi Pico - React.js</title> | |
| <link href="https://cdn.jsdelivr.net/npm/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> |
This file contains hidden or 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
| version: "3.9" | |
| services: | |
| homeassistant: | |
| container_name: homeassistant | |
| image: ghcr.io/home-assistant/home-assistant:stable | |
| volumes: | |
| - 'C:\docker\homeassistant:/config' | |
| environment: | |
| - IN=Asia/Calcutta # You can find your time zone here - https://en.wikipedia.org/wiki/List_of_tz_database_time_zones | |
| ports: |
This file contains hidden or 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 phew import server, connect_to_wifi | |
| import machine | |
| import json | |
| ip = connect_to_wifi("YOUR_SSID", "YOUR_PASSWORD") | |
| led_green = machine.Pin(0, machine.Pin.OUT) | |
| led_red = machine.Pin(1, machine.Pin.OUT) | |
| print("connected to IP ", ip) |
This file contains hidden or 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
| import network | |
| import sys | |
| import time | |
| import requests | |
| import json | |
| from machine import Pin | |
| wlan = network.WLAN(network.STA_IF) | |
| led = Pin(0, Pin.OUT) |
This file contains hidden or 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
| import tkinter as tk | |
| from tkinter import messagebox | |
| from scapy.all import ARP, Ether, srp | |
| def get_connected_devices(): | |
| arp_request = Ether(dst="ff:ff:ff:ff:ff:ff") / ARP(pdst="192.168.1.0/24") | |
| result = srp(arp_request, timeout=3, verbose=False)[0] | |
| 7C67 | connected_devices = [{'ip': received.psrc, 'mac': received.hwsrc, 'hostname': received.getlayer(ARP).psrc} for sent, received in result] |
This file contains hidden or 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
| import machine | |
| import time | |
| import os | |
| # Function to read temperature sensor | |
| def read_temperature(): | |
| adc = machine.ADC(4) # Use ADC pin GP4 | |
| conversion_factor = 3.3 / (65535) # ADC conversion factor | |
| sensor_value = adc.read_u16() * conversion_factor | |
| temperature = 27 - (sensor_value - 0.706) / 0.001721 # Convert sensor value to temperature (formula may vary) |
This file contains hidden or 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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <title>Raspberry Pi Pico Web Server</title> | |
| <!-- Required meta tags --> | |
| <meta charset="utf-8" /> | |
| <meta | |
| name="viewport" | |
| content="width=device-width, initial-scale=1, shrink-to-fit=no" | |
| /> |