User:Beau-K6eau
Revision as of 18:06, 3 January 2024 by Beau-K6eau (talk | contribs)
Hello world
37C3
[LED_Dot_Matrix_Display]
Hacker Dojo 37C3
Getting to Blinky
MicroPython & ESP8266
code
from machine import Pin, ADC from time import sleep_ms print('Hacker Dojo ESP8266 booting...') # MicroPython Getting Startred Reference # http://docs.micropython.org/en/latest/esp8266/quickref.html#pins-and-gpio # AI Thinker EASP8266 Module Pin Out # https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2019/05/ESP8266-ESP-12E-chip-pinout-gpio-pin.png # LinkNode D1 Arduino Uno form factor # https://learn.linksprite.com/linkspriteio/linknode/linknode-d1/ # TODO: Feature # https://wiki.seeedstudio.com/Grove-LED_String_Light/ p0 = Pin(0, Pin.IN, Pin.PULL_UP) # Button # https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/overview p2 = Pin(2, Pin.IN) # PiR p12 = Pin(12, Pin.OUT, value=1) # GREEN p13 = Pin(13, Pin.OUT, value=1) # RED p14 = Pin(14, Pin.OUT, value=1) # BLUE a0 = ADC(0) # Light Sensor https://arduinogetstarted.com/tutorials/arduino-light-sensor def button_handler(pin): print("button") blink() def pir_handler(pin): print("PiR") motion_trigger() # https://randomnerdtutorials.com/micropython-interrupts-esp32-esp8266/ p0.irq(trigger=Pin.IRQ_FALLING, handler=button_handler) p2.irq(trigger=Pin.IRQ_RISING, handler=pir_handler) def motion_trigger(): for i in range(0, 10): p13.value(not p13.value()) sleep_ms(100) def blink(): p12.value(0) sleep_ms(200) p12.value(1) p13.value(0) sleep_ms(200) p13.value(1) p14.value(0) sleep_ms(200) p14.value(1) blink() def do_connect(): import network wlan = network.WLAN(network.STA_IF) wlan.active(True) if not wlan.isconnected(): print('connecting to network...') wlan.connect('Hacker Dojo Free', 'hackerdojo') while not wlan.isconnected(): pass print('network config:', wlan.ifconfig()) # do_connect()
Made with a breadboard and random bits found in the electronics lab. 37C3 hack'n with Brick Breakers.