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 machine import Pin | |
led = Pin(2, Pin.OUT) | |
key = Pin(0, Pin.IN, Pin.PULL_UP) | |
while True: | |
state = not key.value() | |
led.value(state) |
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
#include <SoftwareSerial.h> | |
SoftwareSerial mySerial(2, 3); // RX, TX | |
void setup() { | |
mySerial.begin(9600); | |
} | |
void loop() { | |
mySerial.println("Hello DSLogic!!"); |
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
#define PIN_S 8 | |
#define INTERVAL_MS 1 | |
void setup() { | |
pinMode(PIN_S, OUTPUT); | |
digitalWrite(PIN_S, LOW); | |
} | |
void loop() { |
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 network import WLAN, STA_IF | |
from time import time | |
from machine import SoftI2C, Pin, RTC, Timer | |
from ssd1306 import SSD1306_I2C | |
import ntptime | |
SERVER = 'broker.mqttdashboard.com' | |
PORT = 1883 | |
CLIENT_ID = 'esp32' | |
TOPIC = 'devicemart' |
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 network import WLAN, STA_IF | |
from time import time, sleep | |
from usocket import socket | |
from mqttclient import MQTTClient | |
SERVER = 'broker.mqttdashboard.com' | |
PORT = 1883 | |
CLIENT_ID = 'esp32' | |
TOPIC = 'devicemart' |
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 network import WLAN, STA_IF | |
from time import time, sleep | |
from usocket import socket | |
from mqttclient import MQTTClient | |
SERVER = 'broker.mqttdashboard.com' | |
PORT = 1883 | |
CLIENT_ID = 'esp32' | |
TOPIC = 'devicemart' |
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 network import WLAN, STA_IF | |
from time import time, sleep | |
from usocket import socket | |
wlan = WLAN(STA_IF) | |
wlan.active(True) | |
start_time = time() | |
if not wlan.isconnected(): | |
print('Connecting to network...') |
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 machine import SoftI2C, Pin | |
from ssd1306 import SSD1306_I2C | |
from network import WLAN, STA_IF | |
from time import sleep, time | |
i2c = SoftI2C(sda=Pin(13), scl=Pin(14)) | |
display = SSD1306_I2C(128, 64, i2c, addr=0x3C) | |
led = Pin(2, Pin.OUT) |
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 machine import Pin | |
from neopixel import NeoPixel | |
from time import sleep | |
RED =(255, 0, 0) | |
GREEN =(0, 255, 0) | |
BLUE =(0, 0, 255) | |
WHITE =(255, 255, 255) | |
pixels = NeoPixel(Pin(22, Pin.OUT), 30) |
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 machine import Pin, PWM | |
from time import sleep | |
servo = PWM(Pin(18), freq=50, duty=0) | |
def set_angle(angle): | |
global servo | |
servo.duty(int(((angle + 90) * 2 / 180 + 0.5) / 20 * 1023)) | |
set_angle(-90) |