Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
from machine import ADC from machine import Pin import neopixel import time #Pulsador puls1 = Pin(14, Pin.IN) puls2 = Pin(15, Pin.IN) #Entradas analógicas pot = ADC(Pin(32)) joyx = ADC(Pin(39)) joyy = ADC(Pin(36)) pot.atten(ADC.ATTN_11DB) joyx.atten(ADC.ATTN_11DB) joyy.atten(ADC.ATTN_11DB) #LED ain1 = Pin(12, Pin.OUT) ain2 = Pin(13, Pin.OUT) bin1 = Pin(18, Pin.OUT) bin2 = Pin(19, Pin.OUT) #LED RGB ledRGB = neopixel.NeoPixel(Pin(4, Pin.OUT), 3) while True: if puls1.value() == 1: ledRGB[0] = (0x22, 0x00, 0x00) elif puls1.value() == 0: ledRGB[0] = (0x00, 0x22, 0x00) if puls2.value() == 1: ledRGB[2] = (0x00, 0x00, 0x0FF) elif puls2.value() == 0: ledRGB[2] = (0x00, 0x22, 0x00) ledRGB.write() if pot.read() > 2000: ledRGB[1] = (0x22, 0x22, 0x22) else: ledRGB[1] = (0x00, 0x22, 0x00) if joyx.read() > 2000: ain1.on() ain2.on() else: ain1.off() ain2.off() if joyy.read() > 2000: bin1.on() bin2.on() else: bin1.off() bin2.off()
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)