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
#define PIN_BOTON 8 #define CONFIGURAR_BOTON pinMode(PIN_BOTON, INPUT) #define BOTON_PRESIONADO (digitalRead(PIN_BOTON)==HIGH) #define PIN_LED 13 #define CONFIGURAR_LED pinMode(PIN_LED, OUTPUT) #define ENCENDER_LED digitalWrite(PIN_LED, HIGH) #define APAGAR_LED digitalWrite(PIN_LED, LOW) void setup() { CONFIGURAR_BOTON; CONFIGURAR_LED; ENCENDER_LED; } bool SePresionoBoton(void) { static bool boton_presionado_ant=false; if(BOTON_PRESIONADO == boton_presionado_ant) return(false); boton_presionado_ant=BOTON_PRESIONADO; return(BOTON_PRESIONADO); } void loop() { unsigned long tiempo = 0; if (SePresionoBoton()){ if (millis - tiempo > 50){ tiempo = millis(); } } if(SePresionoBoton()) //Si se presionĂ³ el boton ENCENDER_LED; delay(5000); //esperamos 5 segundo }
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)